summary refs log tree commit diff
path: root/synapse/app/homeserver.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-04 11:34:05 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-04 11:34:23 +0000
commitd6059bdd2ade632b3778d1f475a35ffd4a7242e9 (patch)
treefec5569e3d9f1fd71bfec95c241a5deb7ead3e73 /synapse/app/homeserver.py
parentTrack the cpu used in the main thread by each logging context (diff)
downloadsynapse-d6059bdd2ade632b3778d1f475a35ffd4a7242e9.tar.xz
Fix warnings
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-xsynapse/app/homeserver.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index cd7a52ec07..58c679bbfd 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -499,13 +499,23 @@ class SynapseRequest(Request):
         self.start_time = int(time.time() * 1000)
 
     def finished_processing(self):
+
+        try:
+            context = LoggingContext.current_context()
+            ru_utime, ru_stime = context.get_resource_usage()
+        except:
+            ru_utime, ru_stime = (0, 0)
+
         self.site.access_logger.info(
             "%s - %s - {%s}"
-            " Processed request: %dms %sB %s \"%s %s %s\" \"%s\"",
+            " Processed request: %dms (%dms, %dms)"
+            " %sB %s \"%s %s %s\" \"%s\"",
             self.getClientIP(),
             self.site.site_tag,
             self.authenticated_entity,
             int(time.time() * 1000) - self.start_time,
+            int(ru_utime * 1000),
+            int(ru_stime * 1000),
             self.sentLength,
             self.code,
             self.method,