comparison mercurial/statprof.py @ 41365:876494fd967d

cleanup: delete lots of unused local variables These were found by IntelliJ. There are many more, but these seemed pretty safe. Differential Revision: https://phab.mercurial-scm.org/D5629
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 17 Jan 2019 09:17:12 -0800
parents 8664fdc1cfb3
children ae189674bdad
comparison
equal deleted inserted replaced
41364:0132221c25cd 41365:876494fd967d
814 id2stack.append(dict(category=stack[0][0], name='%s %s' % stack[0])) 814 id2stack.append(dict(category=stack[0][0], name='%s %s' % stack[0]))
815 if parent is not None: 815 if parent is not None:
816 id2stack[-1].update(parent=parent) 816 id2stack[-1].update(parent=parent)
817 return myid 817 return myid
818 818
819 def endswith(a, b):
820 return list(a)[-len(b):] == list(b)
821
822 # The sampling profiler can sample multiple times without 819 # The sampling profiler can sample multiple times without
823 # advancing the clock, potentially causing the Chrome trace viewer 820 # advancing the clock, potentially causing the Chrome trace viewer
824 # to render single-pixel columns that we cannot zoom in on. We 821 # to render single-pixel columns that we cannot zoom in on. We
825 # work around this by pretending that zero-duration samples are a 822 # work around this by pretending that zero-duration samples are a
826 # millisecond in length. 823 # millisecond in length.
856 853
857 # Much fiddling to synthesize correctly(ish) nested begin/end 854 # Much fiddling to synthesize correctly(ish) nested begin/end
858 # events given only stack snapshots. 855 # events given only stack snapshots.
859 856
860 for sample in data.samples: 857 for sample in data.samples:
861 tos = sample.stack[0]
862 name = tos.function
863 path = simplifypath(tos.path)
864 stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno), 858 stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno),
865 frame.function) for frame in sample.stack)) 859 frame.function) for frame in sample.stack))
866 qstack = collections.deque(stack) 860 qstack = collections.deque(stack)
867 if laststack == qstack: 861 if laststack == qstack:
868 continue 862 continue