This is an archive of the discontinued Mercurial Phabricator instance.

tracing: new module to make tracing events in hg easier
ClosedPublic

Authored by durin42 on Aug 21 2018, 5:39 PM.

Details

Summary

This lives in hgdemandimport because I want to instrument a bunch of
low-level stuff including the bare hg script and demandimport, so it
can't live at a higher layer.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Aug 21 2018, 5:39 PM
indygreg added inline comments.
hgdemandimport/tracing.py
32–35

Per my comment in D4342, I think we should consider recording the timing from here so times aren't skewed due to the presence of pipe I/O. That will introduce some overhead in the traced process. But such is the price to be paid for accurate time reporting, I suppose.

This revision was automatically updated to reflect the committed changes.

Per my comment in https://phab.mercurial-scm.org/D4342 https://phab.mercurial-scm.org/D4342, I think we should consider recording the timing from here so times aren't skewed due to the presence of pipe I/O. That will introduce some overhead in the traced process. But such is the price to be paid for accurate time reporting, I suppose.

My thinking on that was to avoid the syscall overhead for getting timestamps in the main hg process, which we’ve seen be a huge drag on performance. I couldn’t think of anything cheaper than a single string interpolation and a write to a named pipe, so that’s what we’ve got for now - we can always pursue more in the future if we want, but I want this tracing to be cheap enough that I could plausibly turn it on for 1% of invocations )or whatever) and not have users notice.