summaryrefslogtreecommitdiff
path: root/service/test/reactor
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2016-08-25 18:50:39 -0300
committerThais Siqueira <thais.siqueira@gmail.com>2016-08-25 19:05:51 -0300
commit6ee8dd10dbc7e97ee29e05dcd922ce5070a371f8 (patch)
treeb95f753ccbbc1254970a8c3600a30b9a038472bb /service/test/reactor
parentdac8b3cb37603b820ddb46df58a986aec38488f6 (diff)
Adapted the twisted patch to measure inlineCallbacks #768
We did two changes to the twisted patch to be able to measure the inlineCallbacks correctly: - Filtered the traditional callbacks timing so that it doesn't print inlineCallback timings - Added a measurement for the g.send() method inside the inlineCallback, to measure the actual execution time of the call on the main thread, between the inlineCallback yields
Diffstat (limited to 'service/test/reactor')
-rw-r--r--service/test/reactor/defer.patch24
1 files changed, 14 insertions, 10 deletions
diff --git a/service/test/reactor/defer.patch b/service/test/reactor/defer.patch
index de2f7d82..296112f4 100644
--- a/service/test/reactor/defer.patch
+++ b/service/test/reactor/defer.patch
@@ -6,11 +6,11 @@
> self.start = datetime.now()
> self.label = label
>
-> def stop(self):
+> def stop(self, callback_type):
> end = datetime.now()
> total = (end - self.start).total_seconds()
> if total > 0.1:
-> print('EXECUTING {} {:.5f}'.format(self.label, total))
+> print('EXECUTING {}: {} {:.5f}'.format(callback_type, self.label, total))
>
195c208,221
<
@@ -25,23 +25,27 @@
> return str(i)
> else:
> if 'gotResult' == i.__name__:
-> return str(i.__closure__[1].cell_contents)
+> return False
> f = inspect.getsourcefile(i)
> ln = inspect.getsourcelines(i)[1]
> return "%s (%s:%d)" % (str(i), f, ln)
-300a327,329
->
-> # print "addCallbacks(%s, %s)" % (identifyItem(callback), identifyItem(errback))
->
-588c617,625
+588c614,624
< current.result = callback(current.result, *args, **kw)
---
> currentItem = identifyItem(callback)
> currentThreadId = threading.current_thread().ident
>
-> clock = Clock("%s in thread %d" % (currentItem, currentThreadId))
+> if currentItem:
+> clock = Clock("%s in thread %d" % (currentItem, currentThreadId))
> try:
> current.result = callback(current.result, *args, **kw)
> finally:
-> clock.stop()
+> if currentItem:
+> clock.stop('deferred')
>
+1123a1160,1161
+> currentThreadId = threading.current_thread().ident
+> c = Clock("%s in thread %d" % (str(g.gi_code), currentThreadId))
+1175a1214,1215
+> finally:
+> c.stop('inlineCallback')