changeset 42475:ff562d711919

catapipe: add support for COUNTER events Differential Revision: https://phab.mercurial-scm.org/D6524
author Augie Fackler <augie@google.com>
date Wed, 12 Jun 2019 19:00:46 -0400
parents adb636392b3f
children d0b8a3cfd732
files contrib/catapipe.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/catapipe.py	Wed Jun 12 16:08:21 2019 -0400
+++ b/contrib/catapipe.py	Wed Jun 12 19:00:46 2019 -0400
@@ -44,6 +44,7 @@
 _TYPEMAP = {
     'START': 'B',
     'END': 'E',
+    'COUNTER': 'C',
 }
 
 _threadmap = {}
@@ -78,6 +79,11 @@
                 verb, session, label = ev.split(' ', 2)
                 if session not in _threadmap:
                     _threadmap[session] = len(_threadmap)
+                if verb == 'COUNTER':
+                    amount, label = label.split(' ', 1)
+                    payload_args = {'value': int(amount)}
+                else:
+                    payload_args = {}
                 pid = _threadmap[session]
                 ts_micros = (now - start) * 1000000
                 out.write(json.dumps(
@@ -88,7 +94,7 @@
                         "ts": ts_micros,
                         "pid": pid,
                         "tid": 1,
-                        "args": {}
+                        "args": payload_args,
                     }))
                 out.write(',\n')
     finally: