Patchwork D6524: catapipe: add support for COUNTER events

login
register
mail settings
Submitter phabricator
Date June 14, 2019, 11:16 p.m.
Message ID <df9848448a9987eb43238f3026cc3fa1@localhost.localdomain>
Download mbox | patch
Permalink /patch/40522/
State Not Applicable
Headers show

Comments

phabricator - June 14, 2019, 11:16 p.m.
Closed by commit rHGff562d711919: catapipe: add support for COUNTER events (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6524?vs=15476&id=15524

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6524/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6524

AFFECTED FILES
  contrib/catapipe.py

CHANGE DETAILS




To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/contrib/catapipe.py b/contrib/catapipe.py
--- a/contrib/catapipe.py
+++ b/contrib/catapipe.py
@@ -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: