ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DQUtils
python
ext
lsprofcalltree.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3
def
label
(code):
4
if
isinstance(code, str):
5
return
(
'~'
, 0, code)
# built-in functions ('~' sorts at the end)
6
else
:
7
return
'%s %s:%d'
% (code.co_name, code.co_filename, code.co_firstlineno)
8
9
10
11
class
KCacheGrind
(object):
12
def
__init__
(self, profiler):
13
self.
data
= profiler.getstats()
14
self.
out_file
=
None
15
16
def
output(self, out_file):
17
self.
out_file
= out_file
18
print
(
'events: Ticks'
, file=out_file)
19
self.
_print_summary
()
20
for
entry
in
self.
data
:
21
self.
_entry
(entry)
22
23
def
_print_summary
(self):
24
max_cost = 0
25
for
entry
in
self.
data
:
26
totaltime = int(entry.totaltime * 1000)
27
max_cost =
max
(max_cost, totaltime)
28
print
(
'summary: %d'
% (max_cost,), file=self.
out_file
)
29
30
def
_entry
(self, entry):
31
out_file = self.
out_file
32
code = entry.code
33
inlinetime = int(entry.inlinetime * 1000)
34
#print >> out_file, 'ob=%s' % (code.co_filename,)
35
if
isinstance(code, str):
36
print
(
'fi=~'
, file=out_file)
37
else
:
38
print
(
'fi=%s'
% (code.co_filename,), file=out_file)
39
print
(
'fn=%s'
% (
label
(code),), file=out_file)
40
if
isinstance(code, str):
41
print
(
'0 '
, inlinetime, file=out_file)
42
else
:
43
print
(
'%d %d'
% (code.co_firstlineno, inlinetime), file=out_file)
44
# recursive calls are counted in entry.calls
45
if
entry.calls:
46
calls = entry.calls
47
else
:
48
calls = []
49
if
isinstance(code, str):
50
lineno = 0
51
else
:
52
lineno = code.co_firstlineno
53
for
subentry
in
calls:
54
self.
_subentry
(lineno, subentry)
55
print
(file=out_file)
56
57
def
_subentry
(self, lineno, subentry):
58
out_file = self.
out_file
59
code = subentry.code
60
totaltime = int(subentry.totaltime * 1000)
61
#print >> out_file, 'cob=%s' % (code.co_filename,)
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)
66
else
:
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)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
max
#define max(a, b)
Definition
cfImp.cxx:41
python.ext.lsprofcalltree.KCacheGrind
Definition
lsprofcalltree.py:11
python.ext.lsprofcalltree.KCacheGrind.data
data
Definition
lsprofcalltree.py:13
python.ext.lsprofcalltree.KCacheGrind._entry
_entry(self, entry)
Definition
lsprofcalltree.py:30
python.ext.lsprofcalltree.KCacheGrind.out_file
out_file
Definition
lsprofcalltree.py:14
python.ext.lsprofcalltree.KCacheGrind._subentry
_subentry(self, lineno, subentry)
Definition
lsprofcalltree.py:57
python.ext.lsprofcalltree.KCacheGrind._print_summary
_print_summary(self)
Definition
lsprofcalltree.py:23
python.ext.lsprofcalltree.KCacheGrind.__init__
__init__(self, profiler)
Definition
lsprofcalltree.py:12
python.ext.lsprofcalltree.label
label(code)
Definition
lsprofcalltree.py:3
Generated on
for ATLAS Offline Software by
1.17.0