Mercurial > hg
comparison mercurial/lsprof.py @ 9325:74e717a21779
Merge with mpm
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 06 Aug 2009 18:48:00 -0700 |
parents | 1fa80c5428b8 3f93f6838639 |
children | 23e608f42f2c |
comparison
equal
deleted
inserted
replaced
9315:fb66a7d3f28f | 9325:74e717a21779 |
---|---|
24 | 24 |
25 def sort(self, crit="inlinetime"): | 25 def sort(self, crit="inlinetime"): |
26 """XXX docstring""" | 26 """XXX docstring""" |
27 if crit not in profiler_entry.__dict__: | 27 if crit not in profiler_entry.__dict__: |
28 raise ValueError("Can't sort by %s" % crit) | 28 raise ValueError("Can't sort by %s" % crit) |
29 self.data.sort(lambda b, a: cmp(getattr(a, crit), | 29 self.data.sort(key=lambda x: getattr(x, crit), reverse=True) |
30 getattr(b, crit))) | |
31 for e in self.data: | 30 for e in self.data: |
32 if e.calls: | 31 if e.calls: |
33 e.calls.sort(lambda b, a: cmp(getattr(a, crit), | 32 e.calls.sort(key=lambda x: getattr(x, crit), reverse=True) |
34 getattr(b, crit))) | |
35 | 33 |
36 def pprint(self, top=None, file=None, limit=None, climit=None): | 34 def pprint(self, top=None, file=None, limit=None, climit=None): |
37 """XXX docstring""" | 35 """XXX docstring""" |
38 if file is None: | 36 if file is None: |
39 file = sys.stdout | 37 file = sys.stdout |