summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-19 09:26:14 +0100
committerErik Johnston <erik@matrix.org>2015-08-19 10:17:33 +0100
commit118bb5c036ee1e5613a49c7cd862c5372708ac71 (patch)
tree4b42a1304839ff0b4c09eb55ae6a3f6054aec59b
parentTime CPU time spent in each log context (diff)
downloadsynapse-erikj/context_cpu_timing.tar.xz
Cheekily use RUSAGE_THREAD erikj/context_cpu_timing
-rw-r--r--synapse/util/logcontext.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 8a36bbf32d..8c57671b66 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -23,7 +23,8 @@ logger = logging.getLogger(__name__)
 
 
 def _get_cpu_time():
-    return getrusage(RUSAGE_SELF).ru_utime * 1000
+    # Cheekily use RUSAGE_THREAD. THIS IS NOT PORTABLE
+    return getrusage(1).ru_utime * 1000
 
 
 class LoggingContext(object):