Patchwork D6526: tracing: add support for emitting counters

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

Comments

phabricator - June 14, 2019, 11:16 p.m.
Closed by commit rHGe658ac39fe41: tracing: add support for emitting counters (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/D6526?vs=15478&id=15526

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

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

AFFECTED FILES
  hgdemandimport/tracing.py

CHANGE DETAILS




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

Patch

diff --git a/hgdemandimport/tracing.py b/hgdemandimport/tracing.py
--- a/hgdemandimport/tracing.py
+++ b/hgdemandimport/tracing.py
@@ -46,3 +46,13 @@ 
             _pipe.write('END %s %s\n' % (_session, whence))
         except IOError:
             pass
+
+def counter(label, amount, *labelargs):
+    if not _isactive():
+        return
+    l = label % labelargs
+    # See above in log() for why this is in a try/except.
+    try:
+        _pipe.write('COUNTER %s %d %s\n' % (_session, amount, l))
+    except IOError:
+        pass