2
from twisted.spread import pb
3
from twisted.internet import defer, reactor
4
from twisted.cred.credentials import UsernamePassword
12
def callLoop(self, ignored):
13
d1 = self.persp.callRemote("simple")
14
d2 = self.persp.callRemote("complexTypes")
15
defer.DeferredList([d1, d2]).addCallback(self.callLoop)
16
self.calledThisSecond += 1
17
thisSecond = int(time.time())
18
if thisSecond != self.lastSecond:
19
if thisSecond - self.lastSecond > 1:
20
print "WARNING it took more than one second"
21
print 'cps:', self.calledThisSecond
22
self.calledThisSecond = 0
23
self.lastSecond = thisSecond
25
def _cbPerspective(self, persp):
27
self.lastSecond = int(time.time())
31
factory = pb.PBClientFactory()
32
reactor.connectTCP(self.hostname, self.portno, factory)
33
factory.login(UsernamePassword("benchmark", "benchmark")).addCallback(self._cbPerspective)
37
PBBenchClient().runTest()
38
from twisted.internet import reactor
41
if __name__ == '__main__':