ATLAS Offline Software
PerfMonSerializer.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 # @file PerfMonComps/python/PerfMonSerializer
4 
5 __version__ = "$Revision: 524466 $"
6 __doc__ = "various utils to encode/decode perfmon (meta)data with base64"
7 __author__ = "Sebastien Binet, Thomas Kittlemann"
8 
9 
10 def extract_pmon_files(fname):
11  """
12  return a dict of string->file-like objects containing the
13  perfmon data and metadata
14  """
15  if not fname.endswith('pmon.gz'):
16  raise ValueError("expect a xyz.pmon.gz file (got [%s])"%(fname,))
17 
18  import os.path, sys
19  import tarfile
20  import tempfile
21  tmpdir = tempfile.mkdtemp(prefix='pmon_ser_')
22 
23  import atexit, shutil
24  def cleanup_pmon_ser(tmpdir=tmpdir):
25  try:
26  if os.path.exists(tmpdir):
27  shutil.rmtree(tmpdir)
28  except Exception as err:
29  print("pmon.cleanup_pmon_ser: **warning**:\n%s", (err,), file=sys.stderr)
30 
31  atexit.register(cleanup_pmon_ser)
32 
33  tar = tarfile.open(fname, 'r')
34  tar.extractall(path=tmpdir)
35  tar.close()
36 
37  import glob
38  files = glob.glob(os.path.join(tmpdir,'*.stream'))
39  stream_fname = files[0]
40 
41  files = glob.glob(os.path.join(tmpdir,"*.dat"))
42  dat_fname = files[0]
43 
44  files = glob.glob(os.path.join(tmpdir,"*.pmonsd.txt"))
45  semidet_fname = files[0] if files else None
46 
47  return {
48  'infos': open(dat_fname),
49  'data': open(stream_fname),
50  'semidet' : open(semidet_fname) if semidet_fname else None
51  }
52 
53 def extract_pmon_infos(fname, only_summary=False):
54  """ extract the perfmon informations from ``fname``
55  if ``fname`` ends with '.pmon.dat', assume it is a shelve.
56  otherwise, assumes it's a tar-ball with a .pmon.dat shelve inside.
57 
58  returns None in case of errors
59  """
60 
61  def dict_from_shelve(fname):
62  db = {}
63  if open(fname, 'rb').read(1024).startswith(b'SQLite format'):
64  import PyUtils.dbsqlite as dbs
65  db = dbs.open(fname, 'r')
66  else:
67  import shelve
68  try:
69  db = shelve.open(fname)
70  except Exception:
71  pass
72  pass
73  out=dict(db)
74  if not out:
75  return None
76 
77  if only_summary:
78  if 'perf_summary' in out.keys():
79  return {'perf_summary':out['perf_summary']}
80  else:
81  return None
82  return out
83 
84  if fname.endswith('pmon.dat'):
85  return dict_from_shelve(fname)
86 
87  o = extract_pmon_files(fname)
88  infos_file = o['infos']
89  out = dict_from_shelve(infos_file.name)
90  return out
91 
93  from collections import defaultdict
94  out = defaultdict(dict)
95 
96  import numpy as np
97  iocpu_dtype = np.dtype([
98  ('user','float32'),
99  ('sys', 'float32'),
100  ('real','float32'),
101  ('cpu', 'float32'),
102  ('rt', 'float32'),
103  ])
104  cpu_dtype = np.dtype([
105  ('user','3float32'),
106  ('sys', '3float32'),
107  ('real','3float32'),
108  ('cpu', '3float32'),
109  ('rt', '3float32'),
110  ])
111  mem_dtype = np.dtype([
112  ('vmem', '3float32'),
113  ('rss', '3float32'),
114  ('mall', '3float32'),
115  ('nmall', '3int64'),
116  ('nfree', '3int64'),
117  ])
118  comp_dtype=np.dtype([('cpu', cpu_dtype), ('mem', mem_dtype)])
119 
120  def new_component():
121  return np.zeros(0, dtype=comp_dtype)
122 
123  iocomp_dtype = np.dtype([('r', iocpu_dtype),
124  ('rr', iocpu_dtype),
125  ('w', iocpu_dtype),])
126  def new_iocomp():
127  return np.zeros(0, dtype=iocomp_dtype)
128 
129  for step in ('ini', 'evt', 'fin', 'cbk', 'usr',
130  'preLoadProxy', 'dso',):
131  out[step] = defaultdict(new_component)
132  for step in ('io',):
133  out[step] = defaultdict(new_iocomp)
134 
135  return out
136 
138  """
139  iterates over the file pointed at by `fname` and yields a tuple of
140  (step, idx, comp, out)
141  where:
142  - `step` is in ('ini','evt','fin','cbk','usr','dso',...)
143  - `idx` is 0 or 1 (resp. start or stop)
144  - `comp` is the name of the entity being monitored (alg,library,cbk,...)
145  - `out` is the up-to-date table of data collected so far
146 
147  the table is a dict of {'step':{'comp':numpy.array}}
148 
149  this table is the suitable python object for further analyses
150  from a pmon file
151  """
152  if fname.endswith('.pmon.gz'):
153  o = extract_pmon_files(fname)
154  stream_file = o['data']
155  stream_fname = stream_file.name
156  elif fname.endswith('.stream'):
157  stream_file = open(fname)
158  stream_fname= fname
159  else:
160  raise ValueError("expect a xyz.pmon.gz or xyz.stream file (got [%s])"%(fname,))
161 
162  import numpy as np
163  out = _init_pmon_data()
164 
165  with open(stream_fname, 'r') as f:
166  for z in f:
167  data, step, idx, comp = (None, ) * 4
168  if z.startswith('#'):
169  continue
170  #print("[%s]" % l.strip())
171  # handle things like:
172  # /io/std::vector<unsigned int>#L1CaloUnpackingErrors ...
173  # /io/std::map<std::string,std::vector<int> >#mapdata ...
174  z = z.replace('unsigned int', 'unsigned-int')\
175  .replace('> >', '>->')
176 
177  fields = z.split()
178  #print("##",repr(l))
179  if fields[0].startswith(('/ini/','/evt/','/fin/',
180  '/cbk/','/usr/',
181  '/preLoadProxy/',
182  )):
183  # -- handle bug #68142 (components with spaces...)
184  # peek at field[1] and check it is an integer
185  # otherwise, merge field[0] = field[0]+field[1] and shift
186  # everything accordingly
187  # FIXME: this doesn't handle all possible oddly-named comps
188  # but it should be good enough.
189  while 1:
190  try:
191  idx = int(fields[1])
192  except ValueError:
193  fields[0] = fields[0]+fields[1]
194  del fields[1]
195  else:
196  break
197  # --
198 
199  # should be of the form "/step/comp-name"
200  step = fields[0][1:-1]
201  step = step.split('/')[0]
202  comp = fields[0][len(step)+2:]
203  if step == 'cbk':
204  # remove absolute address from cbk
205  # should be like so:
206  # /cbk/PixelDCSSvc[0x1045f9d8]+15
207  # =>
208  # /cbk/PixelDCSSvc+15
209  # /cbk/(component)+(offset)
210  offset = comp.split(']+')[1]
211  bracket_idx = comp.find('[')
212  if bracket_idx > 0:
213  comp = '%s{+%s}' % (comp[:bracket_idx],offset)
214 
215  idx = int(fields[1])
216 
217  data = out[step][comp]
218 
219  if idx == 0:
220  if len(data) == 0:
221  data = np.zeros(1, data.dtype)
222  data = out[step][comp] = np.append(out[step][comp],
223  data[-1])
224  # access last entry
225  data = data[-1]
226 
227  cpu = data['cpu']
228  cpu['user'][idx] = float(fields[2])
229  cpu['sys'][idx] = float(fields[3])
230  cpu['real'][idx] = float(fields[4])
231  cpu['rt'][idx] = float(fields[5])
232  cpu['cpu'][idx] = cpu['user'][idx] + cpu['sys'][idx]
233 
234  mem = data['mem']
235  mem['vmem'][idx] = float(fields[6])/1024. # cnv to Mb
236  mem['rss'][idx] = float(fields[7])/1024.
237  mem['mall'][idx] = float(fields[8])/1024.
238  mem['nmall'][idx]= float(fields[9])
239  mem['nfree'][idx]= float(fields[10])
240  #print("==> [%s][%s][%s]" % (step, comp, idx), data, idx)
241 
242  if idx == 1:
243  d = cpu
244  for n in d.dtype.names:
245  d[n][2] = d[n][1]
246  d[n][1] = d[n][0] + d[n][1]
247  d = mem
248  for n in d.dtype.names:
249  d[n][2] = d[n][1] - d[n][0]
250  pass
251 
252  elif fields[0].startswith('/io/'):
253  step = "io"
254  comp = fields[0][len(step)+2:]
255  data = out[step][comp]
256  if len(data) == 0:
257  data = np.zeros(1, data.dtype)
258  pass
259  data = out[step][comp] = np.append(out[step][comp],
260  data[-1])
261  # access last entry
262  data = data[-1]
263  r = data['r']
264  r['user'] = float(fields[1])
265  r['sys'] = float(fields[2])
266  r['real'] = float(fields[3])
267  r['cpu'] = r['user'] + r['sys']
268  r['rt'] = float(fields[4])
269 
270  rr = data['rr']
271  rr['user'] = float(fields[5])
272  rr['sys'] = float(fields[6])
273  rr['real'] = float(fields[7])
274  rr['cpu'] = rr['user'] + rr['sys']
275  rr['rt'] = float(fields[8])
276 
277  w = data['w']
278  w['user'] = float(fields[9])
279  w['sys'] = float(fields[10])
280  w['real'] = float(fields[11])
281  w['cpu'] = w['user'] + w['sys']
282  w['rt'] = float(fields[12])
283 
284  #print("--> [%s][%s]" % (step, comp), data)
285 
286  elif fields[0].startswith('/dso/'):
287  step = "dso"
288  comp = fields[0][len(step)+2:]
289  data = out[step][comp]
290 
291  idx = int(fields[1])
292  data = out[step][comp]
293 
294  if idx == 0:
295  if len(data) == 0:
296  data = np.zeros(1, data.dtype)
297  data = out[step][comp] = np.append(out[step][comp],
298  data[-1])
299  # access last entry
300  data = data[-1]
301 
302  if len(fields) >= 10:
303  cpu = data['cpu']
304  cpu['user'][idx] = float(fields[2])
305  cpu['sys'][idx] = float(fields[3])
306  cpu['real'][idx] = float(fields[4])
307  cpu['rt'][idx] = float(fields[5])
308  cpu['cpu'][idx] = cpu['user'][idx] + cpu['sys'][idx]
309 
310  mem = data['mem']
311  mem['vmem'][idx] = float(fields[6])/1024. # cnv to Mb
312  mem['rss'][idx] = float(fields[7])/1024.
313  mem['mall'][idx] = float(fields[8])/1024.
314  mem['nmall'][idx]= float(fields[9])
315  mem['nfree'][idx]= float(fields[10])
316 
317  else: # old format
318  cpu = data['cpu']
319  cpu['user'][idx] = 0.
320  cpu['sys'][idx] = 0.
321  cpu['real'][idx] = 0.
322  cpu['rt'][idx] = 0.
323  cpu['cpu'][idx] = 0.
324 
325  mem = data['mem']
326  mem['vmem'][idx] = float(fields[2])/1024. # cnv to Mb
327  mem['rss'][idx] = 0.
328  mem['mall'][idx] = 0.
329  mem['nmall'][idx]= 0.
330  mem['nfree'][idx]= 0.
331  #print("==> [%s][%s][%s]" % (step, comp, idx), data, idx)
332 
333  if idx == 1:
334  d = cpu
335  for n in d.dtype.names:
336  d[n][2] = d[n][1]
337  d[n][1] = d[n][0] + d[n][1]
338  d = mem
339  for n in d.dtype.names:
340  d[n][2] = d[n][1] - d[n][0]
341  pass
342  pass
343  else:
344  print("warning: unhandled field [%s]" % (fields[0],))
345  print(repr(z))
346 
347  # yields what we got so far
348  yield step, idx, comp, out
349 
350  pass # dispatch on fields
351  pass # stream_data
352 
353 def extract_pmon_data(fname):
354  """
355  return a suitable python object for further analyses from a pmon file
356  """
357  out = None
358  for step, idx, comp, table in iextract_pmon_data(fname):
359  out = table
360  pass
361 
362  # to prevent unintended use...
363  for k in out:
364  out[k] = dict(out[k])
365  return out
366 
367 def pmon_load(fname):
368  """ load all the pmon data from a .pmon.gz file ``fname`` and return
369  the tuple (infos, data)
370  """
371  infos = extract_pmon_infos(fname)
372  data = extract_pmon_data(fname)
373  return (infos, data)
374 
375 def encode(data, use_base64=True):
376  """encode some data into a (compressed) string, using base64 (or not)
377  """
378  # Tests show that pickle(protocol==1)+zlib(level=6) gives the best results:
379  import zlib
380  import cPickle as pickle
381  s=zlib.compress(pickle.dumps(data,1),6)
382  if use_base64:
383  import base64
384  return 'B'+base64.b64encode(s)
385  else:
386  return 'R'+s
387 
388 def decode(s):
389  """decode a (compressed) string into a python object
390  """
391  if not s:
392  return None
393  import zlib
394  import cPickle as pickle
395  if s[0]=='B':
396  import base64
397  s=base64.b64decode(s[1:])
398  else:
399  s=s[1:]
400  return pickle.loads(zlib.decompress(s))
401 
402 def build_callgraph(fname):
403  """ take a `fname` pmon file, iterate over its data and return a callgraph
404  for each of the 'ini', 'evt' and 'fin' steps.
405  all over pmon steps are folded into the 3 above ones.
406  each event during the 'evt' step has its own callgraph structure
407  """
408  graph = {
409  'ini': [],
410  'evt': [],
411  'fin': [],
412  }
413 
414  current_step = 'ini'
415  local_ctx = None
416 
417  for step, idx, comp, table in iextract_pmon_data(fname):
418  if idx is None:
419  if comp == 'PerfMonSliceIo':
420  # ignore this component for now...
421  continue
422  elif step == 'io':
423  # ignore io-step for now...
424  continue
425  else:
426  raise RuntimeError(
427  'logic error step=[%s], idx=[%s], comp=[%s]' %
428  (step, idx, comp,)
429  )
430 
431  if comp in ('PerfMonSvc', 'AuditorSvc'):
432  # ignore this component...
433  continue
434 
435 
438  if step != current_step and step in graph.keys():
439  # new step...
440  if current_step == 'ini' and step == 'evt':
441  # transition ini -> first evt
442  current_step = 'evt'
443  elif current_step == 'evt' and step == 'fin':
444  # transition evt -> fin
445  current_step = 'fin'
446  # new context
447 
448  local_ctx = GraphNode('PerfMonSlice')
449  graph[current_step].append(local_ctx)
450 
451  elif current_step == 'evt' and step == 'ini':
452  # late initialization...
453  # fold into 'evt': do not open a new context
454  pass
455  else:
456  raise RuntimeError(
457  'unknown transition [%s -> %s]' % (current_step, step)
458  )
459 
460  if comp == 'PerfMonSlice':
461  if idx == 0:
462  if current_step != 'fin':
463  # new context
464 
465  local_ctx = GraphNode(comp)
466  graph[current_step].append(local_ctx)
467  else:
468  # handled by the state transition stuff above.
469  # this is b/c PerfMonSlice isn't triggered at the real
470  # step boundaries, at least for finalize.
471  # the proper way to address this issue would be to
472  # have our own ApplicationMgr firing the right incidents
473  # and/or custom auditor events...
474  pass
475  elif idx == 1:
476  local_ctx.data_idx = (step, comp, idx)
477  local_ctx.data = table[step][comp][-1]
478  # close context
479 
481  if current_step == 'fin':
482  return graph
483  pass
484  else:
485  raise RuntimeError('unknown index [%s]' % (idx,))
486  else:
487  if idx == 0:
488  # push the stack of contexes
489  parent_ctx = local_ctx
490  local_ctx = GraphNode(comp, parent=parent_ctx)
491  if step not in graph.keys():
492  local_ctx.ctype = step
493  parent_ctx.children.append(local_ctx)
494  elif idx == 1:
495  if comp != local_ctx.name:
496  raise RuntimeError(
497  'closing context [%s] within scope of [%s]' %
498  (comp, local_ctx.name)
499  )
500  assert local_ctx.parent, "unrooted local context [%r]" % (
501  local_ctx,)
502  local_ctx.data_idx = (step, comp, idx)
503  local_ctx.data = table[step][comp][-1]
504  # pop the stack of contexes
505  local_ctx = local_ctx.parent
506  else:
507  raise RuntimeError('unknown index [%s]' % (idx,))
508  pass
509 
510  pass
511 
512  return graph
513 
514 def iter_callgraph(node):
515  """helper function to iterate over a bunch of GraphNodes
516  @return a tuple (node, nest-level)
517  """
518  def _igraph(node, indent=0):
519  yield node,indent
520  for c in node.children:
521  for cc in _igraph(c,indent+1):
522  yield cc
523  return _igraph(node)
524 
525 def callgraph_node_get_data(node, op_name='self'):
526  """return the monitoring data attached to a node of the callgraph
527  ``op_name`` can be: 'self' or 'incl'
528  """
529  assert op_name in ('self', 'incl'),\
530  'op_name must be either \'self\' or \'incl\''
531 
532  data = None
533  op = getattr(node, op_name)
534  if node.ctype in ('comp','dso',
535  'usr','preLoadProxy','cbk'):
536  cpu_usr = op('cpu','user',2)
537  cpu_sys = op('cpu','sys', 2)
538  cpu_real= op('cpu','real',2)
539  cpu_cpu = op('cpu','cpu', 2)
540  mem_vmem= op('mem','vmem',2)
541  mem_rss= op('mem','rss', 2)
542  mem_mall= op('mem','mall',2)
543  mem_nmall=op('mem','nmall',2)
544  mem_nfree=op('mem','nfree',2)
545  data= (cpu_cpu, mem_vmem, cpu_usr, cpu_sys, cpu_real,
546  mem_rss, mem_mall, mem_nmall, mem_nfree)
547  else:
548  raise RuntimeError('unknown node type [%s]' % node.ctype)
549  return ' '.join(map(str,map(int,data)))
550 
551 def cnv_callgraph_to_cachegrind(root, oname, metadata=None):
552  f = open(oname, 'w+b')
553  write = f.write
554 
555  def _get_data(node, op_name='self'):
556  try:
557  return callgraph_node_get_data(node, op_name)
558  except Exception as err:
559  print("."*80)
560  print("node=%r" % node)
561  print(err)
562  raise
563 
564  if metadata:
565  def _get_meta(node):
566  if node.ctype in ('dso','usr','preLoadProxy','cbk'):
567  return node.ctype
568  try:
569  return metadata[node.name]
570  except KeyError:
571 
574  if node.parent:
575  return _get_meta(node.parent)
576  return node.ctype
577  else:
578  def _get_meta(node):
579  return node.ctype
580 
581  write("events: cpu_cpu mem_vmem cpu_user cpu_sys cpu_real "
582  "mem_rss mem_malloc mem_nallocs mem_nfrees\n")
583  import collections
584  import itertools
585  # a dict of component-name => monotonic-counter
586  # to fake line numbers
587  line_nbr = collections.defaultdict(itertools.count().next)
588  for idx, (node, indent) in enumerate(iter_callgraph(root)):
589  write(
590  "\n"
591  "fl=%s.cxx\n"
592  "ob=%s.so\n"
593  "fn=%s\n"
594  "%i %s\n" % (node.ctype,
595  _get_meta(node),
596  node.name,
597  line_nbr[node.name],
598  _get_data(node, op_name='self'),)
599  )
600  for c in node.children:
601  write(
602  "cfl=%s.cxx\n"
603  "cob=%s.so\n"
604  "cfn=%s\n"
605  "calls=%i %i\n%i %s\n" % (
606  c.ctype,
607  _get_meta(c),
608  c.name,
609  1, line_nbr[c.name], line_nbr[node.name],
610  _get_data(c, op_name='incl')
611  )
612  )
613  f.flush()
614  f.close()
615  return
616 
617 def create_cachegrind_files(fname='ntuple.pmon.gz', domainsdb=None):
618  """take (the path to) a pmon file name `fname` and create a bunch of
619  cachegrind files:
620  - one for the 'ini' stage
621  - one for each event
622  - one for the 'fin' stage
623  the cachegrind files will be named like so:
624  <fname>.ini.cgc.out
625  <fname>.evt.xxxx.cgc.out
626  <fname>.fin.cgc.out
627  """
628  # extract graph(s) from perfmon data
629  root_graph = build_callgraph(fname)
630  # get some metadata to help clustering the callgraph
631  if domainsdb is None:
632  domainsdb = extract_pmon_infos(fname)['domains_a2d']
633  for n in ('PerfMonSlice', 'AthMasterSeq',
634  'AthAlgSeq',
635  'AthOutSeq',
636  'AthRegSeq',):
637  domainsdb[n] = 'admin'
638  #
639  tmpl_name = fname.replace('.pmon.gz', '.cgc.out')
640  cnv_callgraph_to_cachegrind(root_graph['ini'][-1],
641  tmpl_name.replace('.cgc', '.ini.cgc'),
642  domainsdb)
643  for ievt, graph in enumerate(root_graph['evt']):
645  graph,
646  tmpl_name.replace('.cgc.out',
647  '.evt.%s.cgc.out' % str(ievt).zfill(4)),
648  domainsdb
649  )
650  cnv_callgraph_to_cachegrind(root_graph['fin'][-1],
651  tmpl_name.replace('.cgc.out', '.fin.cgc.out'),
652  domainsdb)
653  return
654 
655 
657  _sentinel = object()
658  def __init__(self, name, parent=None, children=None,
659  comp_type='comp',
660  stage=None):
661  self.name = name
662  self.parent= parent
663  self.children= []
664  if children:
665  self.children = list(children)[:]
666  self.ctype = comp_type
667 
668  def __repr__(self):
669  parent_name = '<root>'
670  if self.parent:
671  parent_name = self.parent.name
672  return '<GraphNode[%s] p=[%s] c=[%s] type=[%s]>' % (
673  self.name,
674  parent_name,
675  len(self.children),
676  self.ctype,
677  )
678 
679  def _get_data(self, *idx):
680  data = self.data
681  for i in idx:
682  try:
683  data = data[i]
684  except IndexError:
685  return self._sentinel
686  return data
687 
688  def incl(self, *idx):
689  var = self._get_data(*idx)
690  if var is self._sentinel:
691  raise IndexError('no such index %r' % (tuple(idx),))
692  return var
693 
694  def excl(self, *idx):
695  tot = 0.
696  for c in self.children:
697  try:
698  tot += c.incl(*idx)
699  except IndexError:
700  pass
701  return tot
702 
703  def self(self, *idx):
704  incl = self.incl(*idx)
705  excl = self.excl(*idx)
706  return incl - excl
707 
708  def ies(self, *idx):
709  return {
710  'incl': self.incl(*idx),
711  'excl': self.excl(*idx),
712  'self': self.self(*idx),
713  }
714 
715  def has_index(self, *idx):
716  return not (self._get_data(*idx) is self._sentinel)
717 
718  def __getitem__(self, idx):
719  return self.children[idx]
720 
721  pass # class GraphNode
722 
723 
724 
725 if __name__=='__main__':
726  import sys
727  import os.path
728 
729  if len(sys.argv)<2:
730  print("Please supply one or more perfmon files to investigate (*.pmon, *.pmon.gz or *.pmon.dat)")
731  exit(1)
732  for arg in sys.argv[1:]:
733  print("Investigating file",arg)
734  if not os.path.exists(arg):
735  print(" ==> Not found!")
736  continue
737  print("::: keys:",extract_pmon_infos(fname=arg).keys())
738  for only_summary in [True,False]:
739  infodict=extract_pmon_infos(fname=arg,only_summary=only_summary)
740  for use_base64 in [False,True]:
741  s_info="summary" if only_summary else 'full'
742  s_enc="base64" if use_base64 else 'binary'
743  p = encode(data=infodict,use_base64=use_base64)
744  s=' ==> Reading '+s_info+' info with '+s_enc+' encoding: <'+(str(len(p))+' bytes'if p else 'failed')+'>'
745  if p:
746  decoded = decode(p)
747  decodeOk = (decoded==infodict)
748  s+=' [Decoding '+('OK' if decodeOk else 'FAILED')+']'
749  print(s)
750 
751 
752 
753 
754 """
755 import PerfMonComps.PerfMonSerializer as pmon_ser
756 infos,data = pmon_ser.pmon_load('foo.pmon.gz')
757 ddb = infos['domains_a2d']
758 root_graph = pmon_ser.build_callgraph('foo.pmon.gz')
759 evt = root_graph['evt'][-1]
760 domains_stats = collections.defaultdict(float)
761 for c in evt[0][0].children:
762  #print(c.name)
763  if c.name in ddb:
764  domain = ddb[c.name]
765  domains_stats[domain] += c.incl('cpu','cpu',2)
766  else:
767  print('**err**',c.name)
768 
769 print(dict(domains_stats))
770 {'admin': 0.0,
771  'aod': 4.0,
772  'calo': 889.0,
773  'egamma': 1703.0,
774  'id': 2777.0,
775  'jet': 3228.0,
776  'muon': 202.0,
777  'muoncomb': 720.0,
778  'output': 562.0,
779  'tau': 482.0}
780 """
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
python.PerfMonSerializer.extract_pmon_files
def extract_pmon_files(fname)
functions ---------------------------------------------------------------—
Definition: PerfMonSerializer.py:10
python.PerfMonSerializer.cnv_callgraph_to_cachegrind
def cnv_callgraph_to_cachegrind(root, oname, metadata=None)
Definition: PerfMonSerializer.py:551
python.PerfMonSerializer.GraphNode.ies
def ies(self, *idx)
Definition: PerfMonSerializer.py:708
python.PerfMonSerializer.extract_pmon_infos
def extract_pmon_infos(fname, only_summary=False)
Definition: PerfMonSerializer.py:53
python.PerfMonSerializer.GraphNode
classes ----------------------------------------------------------------—
Definition: PerfMonSerializer.py:656
python.PerfMonSerializer.GraphNode.has_index
def has_index(self, *idx)
Definition: PerfMonSerializer.py:715
python.PerfMonSerializer.extract_pmon_data
def extract_pmon_data(fname)
Definition: PerfMonSerializer.py:353
python.PerfMonSerializer.GraphNode._get_data
def _get_data(self, *idx)
Definition: PerfMonSerializer.py:679
python.PerfMonSerializer.iter_callgraph
def iter_callgraph(node)
Definition: PerfMonSerializer.py:514
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:94
python.PerfMonSerializer.GraphNode.__getitem__
def __getitem__(self, idx)
Definition: PerfMonSerializer.py:718
python.PerfMonSerializer.create_cachegrind_files
def create_cachegrind_files(fname='ntuple.pmon.gz', domainsdb=None)
Definition: PerfMonSerializer.py:617
python.PerfMonSerializer.GraphNode.__init__
def __init__(self, name, parent=None, children=None, comp_type='comp', stage=None)
Definition: PerfMonSerializer.py:658
python.PerfMonSerializer.GraphNode.parent
parent
Definition: PerfMonSerializer.py:660
python.PerfMonSerializer.GraphNode.name
name
Definition: PerfMonSerializer.py:659
python.KeyStore.dict
def dict(self)
Definition: KeyStore.py:321
python.PerfMonSerializer.pmon_load
def pmon_load(fname)
Definition: PerfMonSerializer.py:367
python.ByteStreamConfig.write
def write
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:248
python.PerfMonSerializer.callgraph_node_get_data
def callgraph_node_get_data(node, op_name='self')
Definition: PerfMonSerializer.py:525
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
python.PerfMonSerializer.iextract_pmon_data
def iextract_pmon_data(fname)
Definition: PerfMonSerializer.py:137
python.PerfMonSerializer.GraphNode.__repr__
def __repr__(self)
Definition: PerfMonSerializer.py:668
calibdata.exit
exit
Definition: calibdata.py:236
python.PerfMonSerializer.GraphNode.self
def self(self, *idx)
Definition: PerfMonSerializer.py:703
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.PerfMonSerializer.GraphNode.ctype
ctype
Definition: PerfMonSerializer.py:664
python.PerfMonSerializer.build_callgraph
def build_callgraph(fname)
Definition: PerfMonSerializer.py:402
python.PerfMonSerializer.decode
def decode(s)
Definition: PerfMonSerializer.py:388
Trk::open
@ open
Definition: BinningType.h:40
readCCLHist.int
int
Definition: readCCLHist.py:84
python.PerfMonSerializer._init_pmon_data
def _init_pmon_data()
Definition: PerfMonSerializer.py:92
python.KeyStore.list
def list(self, key=None)
Definition: KeyStore.py:318
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
pickleTool.object
object
Definition: pickleTool.py:30
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
python.PerfMonSerializer.encode
def encode(data, use_base64=True)
Definition: PerfMonSerializer.py:375
python.PerfMonSerializer.GraphNode.incl
def incl(self, *idx)
Definition: PerfMonSerializer.py:688
python.PerfMonSerializer.GraphNode._sentinel
_sentinel
Definition: PerfMonSerializer.py:657
python.PerfMonSerializer.GraphNode.children
children
Definition: PerfMonSerializer.py:661
readCCLHist.float
float
Definition: readCCLHist.py:83
python.PerfMonSerializer.GraphNode.excl
def excl(self, *idx)
Definition: PerfMonSerializer.py:694