##// END OF EJS Templates
lsprofcalltree: use print function...
Gregory Szorc -
r27618:5a988b3c default
parent child Browse files
Show More
@@ -10,7 +10,7 b' This software may be used and distribute'
10 10 of the GNU General Public License, incorporated herein by reference.
11 11 """
12 12
13 from __future__ import absolute_import
13 from __future__ import absolute_import, print_function
14 14
15 15 def label(code):
16 16 if isinstance(code, str):
@@ -27,7 +27,7 b' class KCacheGrind(object):'
27 27
28 28 def output(self, out_file):
29 29 self.out_file = out_file
30 print >> out_file, 'events: Ticks'
30 print('events: Ticks', file=out_file)
31 31 self._print_summary()
32 32 for entry in self.data:
33 33 self._entry(entry)
@@ -37,24 +37,23 b' class KCacheGrind(object):'
37 37 for entry in self.data:
38 38 totaltime = int(entry.totaltime * 1000)
39 39 max_cost = max(max_cost, totaltime)
40 print >> self.out_file, 'summary: %d' % (max_cost,)
40 print('summary: %d' % max_cost, file=self.out_file)
41 41
42 42 def _entry(self, entry):
43 43 out_file = self.out_file
44 44
45 45 code = entry.code
46 #print >> out_file, 'ob=%s' % (code.co_filename,)
47 46 if isinstance(code, str):
48 print >> out_file, 'fi=~'
47 print('fi=~', file=out_file)
49 48 else:
50 print >> out_file, 'fi=%s' % (code.co_filename,)
51 print >> out_file, 'fn=%s' % (label(code),)
49 print('fi=%s' % code.co_filename, file=out_file)
50 print('fn=%s' % label(code), file=out_file)
52 51
53 52 inlinetime = int(entry.inlinetime * 1000)
54 53 if isinstance(code, str):
55 print >> out_file, '0 ', inlinetime
54 print('0 ', inlinetime, file=out_file)
56 55 else:
57 print >> out_file, '%d %d' % (code.co_firstlineno, inlinetime)
56 print('%d %d' % (code.co_firstlineno, inlinetime), file=out_file)
58 57
59 58 # recursive calls are counted in entry.calls
60 59 if entry.calls:
@@ -69,20 +68,19 b' class KCacheGrind(object):'
69 68
70 69 for subentry in calls:
71 70 self._subentry(lineno, subentry)
72 print >> out_file
71 print(file=out_file)
73 72
74 73 def _subentry(self, lineno, subentry):
75 74 out_file = self.out_file
76 75 code = subentry.code
77 #print >> out_file, 'cob=%s' % (code.co_filename,)
78 print >> out_file, 'cfn=%s' % (label(code),)
76 print('cfn=%s' % label(code), file=out_file)
79 77 if isinstance(code, str):
80 print >> out_file, 'cfi=~'
81 print >> out_file, 'calls=%d 0' % (subentry.callcount,)
78 print('cfi=~', file=out_file)
79 print('calls=%d 0' % subentry.callcount, file=out_file)
82 80 else:
83 print >> out_file, 'cfi=%s' % (code.co_filename,)
84 print >> out_file, 'calls=%d %d' % (
85 subentry.callcount, code.co_firstlineno)
81 print('cfi=%s' % code.co_filename, file=out_file)
82 print('calls=%d %d' % (
83 subentry.callcount, code.co_firstlineno), file=out_file)
86 84
87 85 totaltime = int(subentry.totaltime * 1000)
88 print >> out_file, '%d %d' % (lineno, totaltime)
86 print('%d %d' % (lineno, totaltime), file=out_file)
@@ -100,7 +100,6 b''
100 100 i18n/polib.py not using absolute_import
101 101 mercurial/cmdutil.py not using absolute_import
102 102 mercurial/commands.py not using absolute_import
103 mercurial/lsprofcalltree.py requires print_function
104 103 mercurial/mail.py requires print_function
105 104 setup.py not using absolute_import
106 105 tests/filterpyflakes.py requires print_function
General Comments 0
You need to be logged in to leave comments. Login now