diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-04 11:34:05 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-04 11:34:23 +0000 |
commit | d6059bdd2ade632b3778d1f475a35ffd4a7242e9 (patch) | |
tree | fec5569e3d9f1fd71bfec95c241a5deb7ead3e73 /synapse/util | |
parent | Track the cpu used in the main thread by each logging context (diff) | |
download | synapse-d6059bdd2ade632b3778d1f475a35ffd4a7242e9.tar.xz |
Fix warnings
Diffstat (limited to 'synapse/util')
-rw-r--r-- | synapse/util/logcontext.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py index 6d7a6c3e2b..2633201528 100644 --- a/synapse/util/logcontext.py +++ b/synapse/util/logcontext.py @@ -23,6 +23,7 @@ try: import resource RUSAGE_THREAD = 1 resource.getrusage(RUSAGE_THREAD) + def get_thread_resource_usage(): return resource.getrusage(RUSAGE_THREAD) except: @@ -137,13 +138,12 @@ class LoggingContext(object): return if self.usage_start: - self.usage_end = get_thread_resource_usage() + self.usage_end = get_thread_resource_usage() def get_resource_usage(self): ru_utime = self.ru_utime ru_stime = self.ru_stime - start = self.usage_start if self.usage_start and threading.current_thread() is self.main_thread: current = get_thread_resource_usage() ru_utime += current.ru_utime - self.usage_start.ru_utime |