/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/lsprof.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import threading
13
13
from _lsprof import Profiler, profiler_entry
14
14
 
15
 
from breezy import errors
 
15
from . import errors
16
16
 
17
17
__all__ = ['profile', 'Stats']
18
18
 
130
130
 
131
131
        :param crit: the data attribute used as the sort key."""
132
132
        if crit not in profiler_entry.__dict__:
133
 
            raise ValueError, "Can't sort by %s" % crit
 
133
            raise ValueError("Can't sort by %s" % crit)
134
134
        self.data.sort(lambda b, a: cmp(getattr(a, crit),
135
135
                                        getattr(b, crit)))
136
136
        for e in self.data:
321
321
        sys.stderr.write("usage: lsprof.py <script> <arguments...>\n")
322
322
        sys.exit(2)
323
323
    sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
324
 
    stats = profile(execfile, sys.argv[0], globals(), locals())
325
 
    stats.sort()
 
324
    stats = sorted(profile(execfile, sys.argv[0], globals(), locals()))
326
325
    stats.pprint()