annotate mercurial/lsprof.py @ 49487:e8481625c582

rust: add Debug constraint to Matcher trait This makes sure we can easily debug which Matcher we're looking at when using trait objects, and is just generally useful. Effort to make the debugging output nicer has been kept to a minimum, please feel free to improve.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 11 Jul 2022 11:59:13 +0200
parents 642e31cb55f0
children 18c8c18993f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
1 import _lsprof
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
2 import sys
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
3
43089
c59eb1560c44 py3: manually import getattr where it is needed
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
4 from .pycompat import getattr
c59eb1560c44 py3: manually import getattr where it is needed
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
5
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
6 Profiler = _lsprof.Profiler
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
7
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
8 # PyPy doesn't expose profiler_entry from the module.
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
9 profiler_entry = getattr(_lsprof, 'profiler_entry', None)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
10
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
11 __all__ = [b'profile', b'Stats']
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
12
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
13
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
14 def profile(f, *args, **kwds):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
15 """XXX docstring"""
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
16 p = Profiler()
5992
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
17 p.enable(subcalls=True, builtins=True)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
18 try:
5992
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
19 f(*args, **kwds)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
20 finally:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
21 p.disable()
5992
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
22 return Stats(p.getstats())
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
23
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
24
48946
642e31cb55f0 py3: use class X: instead of class X(object):
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48937
diff changeset
25 class Stats:
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
26 """XXX docstring"""
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
27
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
28 def __init__(self, data):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
29 self.data = data
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
30
43503
313e3a279828 cleanup: remove pointless r-prefixes on double-quoted strings
Augie Fackler <augie@google.com>
parents: 43108
diff changeset
31 def sort(self, crit="inlinetime"):
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
32 """XXX docstring"""
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
33 # profiler_entries isn't defined when running under PyPy.
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
34 if profiler_entry:
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
35 if crit not in profiler_entry.__dict__:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
36 raise ValueError(b"Can't sort by %s" % crit)
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
37 elif self.data and not getattr(self.data[0], crit, None):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
38 raise ValueError(b"Can't sort by %s" % crit)
27061
9c75daf89450 lsprof: support PyPy (issue4573)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 18642
diff changeset
39
9032
1fa80c5428b8 compat: use 'key' argument instead of 'cmp' when sorting a list
Alejandro Santos <alejolp@alejolp.com>
parents: 7875
diff changeset
40 self.data.sort(key=lambda x: getattr(x, crit), reverse=True)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
41 for e in self.data:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
42 if e.calls:
9032
1fa80c5428b8 compat: use 'key' argument instead of 'cmp' when sorting a list
Alejandro Santos <alejolp@alejolp.com>
parents: 7875
diff changeset
43 e.calls.sort(key=lambda x: getattr(x, crit), reverse=True)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
44
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
45 def pprint(self, top=None, file=None, limit=None, climit=None):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
46 """XXX docstring"""
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
47 if file is None:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
48 file = sys.stdout
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
49 d = self.data
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
50 if top is not None:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
51 d = d[:top]
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
52 cols = b"% 12d %12d %11.4f %11.4f %s\n"
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
53 hcols = b"% 12s %12s %12s %12s %s\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
54 file.write(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
55 hcols
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
56 % (
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
57 b"CallCount",
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
58 b"Recursive",
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
59 b"Total(s)",
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
60 b"Inline(s)",
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
61 b"module:lineno(function)",
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
62 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
63 )
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
64 count = 0
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
65 for e in d:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
66 file.write(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
67 cols
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
68 % (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
69 e.callcount,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
70 e.reccallcount,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
71 e.totaltime,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
72 e.inlinetime,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
73 label(e.code),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
74 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
75 )
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
76 count += 1
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
77 if limit is not None and count == limit:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
78 return
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
79 ccount = 0
16263
be92ddc636e3 profile: add undocumented config options for profiler output
Matt Mackall <mpm@selenic.com>
parents: 14959
diff changeset
80 if climit and e.calls:
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
81 for se in e.calls:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
82 file.write(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
83 cols
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
84 % (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
85 se.callcount,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
86 se.reccallcount,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
87 se.totaltime,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
88 se.inlinetime,
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
89 b" %s" % label(se.code),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
90 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
91 )
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
92 count += 1
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
93 ccount += 1
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
94 if limit is not None and count == limit:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
95 return
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
96 if climit is not None and ccount == climit:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
97 break
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
98
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
99 def freeze(self):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
100 """Replace all references to code objects with string
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
101 descriptions; this makes it possible to pickle the instance."""
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
102
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
103 # this code is probably rather ickier than it needs to be!
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
104 for i in range(len(self.data)):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
105 e = self.data[i]
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
106 if not isinstance(e.code, str):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
107 self.data[i] = type(e)((label(e.code),) + e[1:])
5992
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
108 if e.calls:
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
109 for j in range(len(e.calls)):
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
110 se = e.calls[j]
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
111 if not isinstance(se.code, str):
30c40ba10963 updating lsprof.py from remote repository
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 2497
diff changeset
112 e.calls[j] = type(se)((label(se.code),) + se[1:])
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
113
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
114
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
115 _fn2mod = {}
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
116
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40202
diff changeset
117
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
118 def label(code):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
119 if isinstance(code, str):
48937
32ac127c999f lsprof: remove some Python 2.7 compatibility code
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48913
diff changeset
120 return code.encode('latin-1')
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
121 try:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
122 mname = _fn2mod[code.co_filename]
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
123 except KeyError:
48913
f254fc73d956 global: bulk replace simple pycompat.iteritems(x) with x.items()
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48875
diff changeset
124 for k, v in list(sys.modules.items()):
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
125 if v is None:
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
126 continue
14959
b1dcc5ab86cd lsprof: use getattr instead of hasattr
Augie Fackler <durin42@gmail.com>
parents: 12842
diff changeset
127 if not isinstance(getattr(v, '__file__', None), str):
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
128 continue
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
129 if v.__file__.startswith(code.co_filename):
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
130 mname = _fn2mod[code.co_filename] = k
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
131 break
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
132 else:
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
133 mname = _fn2mod[code.co_filename] = '<%s>' % code.co_filename
40202
56ea22fa55f0 py3: encode str to bytes
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40193
diff changeset
134
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
135 res = '%s:%d(%s)' % (mname, code.co_firstlineno, code.co_name)
2422
6aa75e77cafe add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
136
48937
32ac127c999f lsprof: remove some Python 2.7 compatibility code
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48913
diff changeset
137 return res.encode('latin-1')