mercurial/lsprof.py
changeset 9032 1fa80c5428b8
parent 7875 553aa0cbeab6
child 9316 23cf7b52785a
equal deleted inserted replaced
9031:3b76321aa0de 9032:1fa80c5428b8
    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