MCPcopy
hub / github.com/pyload/pyload / run

Method run

module/common/APIExerciser.py:60–91  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 #self.start()
59
60 def run(self):
61
62 self.core.log.info("API Excerciser started %d" % self.id)
63
64 out = open("error.log", "ab")
65 #core errors are not logged of course
66 out.write("\n" + "Starting\n")
67 out.flush()
68
69 while True:
70 try:
71 self.testAPI()
72 except Exception:
73 self.core.log.error("Excerciser %d throw an execption" % self.id)
74 print_exc()
75 out.write(format_exc() + 2 * "\n")
76 out.flush()
77
78 if not self.count % 100:
79 self.core.log.info("Exerciser %d tested %d api calls" % (self.id, self.count))
80 if not self.count % 1000:
81 out.flush()
82
83 if not sumCalled % 1000: #not thread safe
84 self.core.log.info("Exercisers tested %d api calls" % sumCalled)
85 persec = sumCalled / (time() - self.time)
86 self.core.log.info("Approx. %.2f calls per second." % persec)
87 self.core.log.info("Approx. %.2f ms per call." % (1000 / persec))
88 self.core.log.info("Collected garbage: %d" % gc.collect())
89
90
91 #sleep(random() / 500)
92
93 def testAPI(self):
94 global sumCalled

Callers

nothing calls this directly

Calls 5

testAPIMethod · 0.95
format_excFunction · 0.50
writeMethod · 0.45
flushMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected