4 if isinstance(code, str):
7 return '%s %s:%d' % (code.co_name, code.co_filename, code.co_firstlineno)
13 self.
data = profiler.getstats()
18 print(
'events: Ticks', file=out_file)
20 for entry
in self.
data:
25 for entry
in self.
data:
26 totaltime =
int(entry.totaltime * 1000)
27 max_cost =
max(max_cost, totaltime)
33 inlinetime =
int(entry.inlinetime * 1000)
35 if isinstance(code, str):
36 print(
'fi=~', file=out_file)
38 print(
'fi=%s' % (code.co_filename,), file=out_file)
40 if isinstance(code, str):
41 print(
'0 ', inlinetime, file=out_file)
43 print(
'%d %d' % (code.co_firstlineno, inlinetime), file=out_file)
49 if isinstance(code, str):
52 lineno = code.co_firstlineno
53 for subentry
in calls:
60 totaltime =
int(subentry.totaltime * 1000)
62 print(
'cfn=%s' % (
label(code),), file=out_file)
63 if isinstance(code, str):
64 print(
'cfi=~', file=out_file)
65 print(
'calls=%d 0' % (subentry.callcount,), file=out_file)
67 print(
'cfi=%s' % (code.co_filename,), file=out_file)
68 print(
'calls=%d %d' % (
69 subentry.callcount, code.co_firstlineno), file=out_file)
70 print(
'%d %d' % (lineno, totaltime), file=out_file)