These are used for simple compares. We don't need to normalize to bytes.
As part of this, I expanded a set literal so entries are 1 per line.
pulkit |
hg-reviewers |
These are used for simple compares. We don't need to normalize to bytes.
As part of this, I expanded a set literal so entries are 1 per line.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/statprof.py (25 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Gregory Szorc | Oct 12 2018, 12:37 PM |
pycompat, | pycompat, | ||||
) | ) | ||||
defaultdict = collections.defaultdict | defaultdict = collections.defaultdict | ||||
contextmanager = contextlib.contextmanager | contextmanager = contextlib.contextmanager | ||||
__all__ = ['start', 'stop', 'reset', 'display', 'profile'] | __all__ = ['start', 'stop', 'reset', 'display', 'profile'] | ||||
skips = {"util.py:check", "extensions.py:closure", | skips = { | ||||
"color.py:colorcmd", "dispatch.py:checkargs", | r"util.py:check", | ||||
"dispatch.py:<lambda>", "dispatch.py:_runcatch", | r"extensions.py:closure", | ||||
"dispatch.py:_dispatch", "dispatch.py:_runcommand", | r"color.py:colorcmd", | ||||
"pager.py:pagecmd", "dispatch.py:run", | r"dispatch.py:checkargs", | ||||
"dispatch.py:dispatch", "dispatch.py:runcommand", | r"dispatch.py:<lambda>", | ||||
"hg.py:<module>", "evolve.py:warnobserrors", | r"dispatch.py:_runcatch", | ||||
r"dispatch.py:_dispatch", | |||||
r"dispatch.py:_runcommand", | |||||
r"pager.py:pagecmd", | |||||
r"dispatch.py:run", | |||||
r"dispatch.py:dispatch", | |||||
r"dispatch.py:runcommand", | |||||
r"hg.py:<module>", | |||||
r"evolve.py:warnobserrors", | |||||
} | } | ||||
########################################################################### | ########################################################################### | ||||
## Utils | ## Utils | ||||
def clock(): | def clock(): | ||||
times = os.times() | times = os.times() | ||||
return (times[0] + times[1], times[4]) | return (times[0] + times[1], times[4]) | ||||
child = self.children.get(site) | child = self.children.get(site) | ||||
if not child: | if not child: | ||||
child = HotNode(site) | child = HotNode(site) | ||||
self.children[site] = child | self.children[site] = child | ||||
if len(stack) > 1: | if len(stack) > 1: | ||||
i = 1 | i = 1 | ||||
# Skip boiler plate parts of the stack | # Skip boiler plate parts of the stack | ||||
while i < len(stack) and '%s:%s' % (stack[i].filename(), stack[i].function) in skips: | name = r'%s:%s' % (stack[i].filename(), stack[i].function) | ||||
while i < len(stack) and name in skips: | |||||
i += 1 | i += 1 | ||||
if i < len(stack): | if i < len(stack): | ||||
child.add(stack[i:], time) | child.add(stack[i:], time) | ||||
root = HotNode(None) | root = HotNode(None) | ||||
lasttime = data.samples[0].time | lasttime = data.samples[0].time | ||||
for sample in data.samples: | for sample in data.samples: | ||||
root.add(sample.stack[::-1], sample.time - lasttime) | root.add(sample.stack[::-1], sample.time - lasttime) |