mercurial/lsprof.py
changeset 9325 74e717a21779
parent 9032 1fa80c5428b8
parent 9314 3f93f6838639
child 10339 23e608f42f2c
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