<s> from twisted . spread import pb <EOL> from twisted . internet import defer , reactor <EOL> from twisted . cred . credentials import UsernamePassword <EOL> import time <EOL> class PBBenchClient : <EOL> hostname = '<STR_LIT:localhost>' <EOL> portno = pb . portno <EOL> calledThisSecond = <NUM_LIT:0> <EOL> def callLoop ( self , ignored ) : <EOL> d1 = self . persp . callRemote ( "<STR_LIT>" ) <EOL> d2 = self . persp . callRemote ( "<STR_LIT>" ) <EOL> defer . DeferredList ( [ d1 , d2 ] ) . addCallback ( self . callLoop ) <EOL> self . calledThisSecond += <NUM_LIT:1> <EOL> thisSecond = int ( time . time ( ) ) <EOL> if thisSecond != self . lastSecond : <EOL> if thisSecond - self . lastSecond > <NUM_LIT:1> : <EOL> print "<STR_LIT>" <EOL> print '<STR_LIT>' , self . calledThisSecond <EOL> self . calledThisSecond = <NUM_LIT:0> <EOL> self . lastSecond = thisSecond <EOL> def _cbPerspective ( self , persp ) : <EOL> self . persp = persp <EOL> self . lastSecond = int ( time . time ( ) ) <EOL> self . callLoop ( None ) <EOL> def runTest ( self ) : <EOL> factory = pb . PBClientFactory ( ) <EOL> reactor . connectTCP ( self . hostname , self . portno , factory ) <EOL> factory . login ( UsernamePassword ( "<STR_LIT>" , "<STR_LIT>" ) ) . addCallback ( self . _cbPerspective ) <EOL> def main ( ) : <EOL> PBBenchClient ( ) . runTest ( ) <EOL> from twisted . internet import reactor <EOL> reactor . run ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
