CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
dqmMemoryStats.HistogramAnalyzer Class Reference
Inheritance diagram for dqmMemoryStats.HistogramAnalyzer:

Public Member Functions

def __init__ (self)
 
def analyze (self, fn, obj)
 
def difference (self, ref)
 
def group (self, level, countObjects)
 

Static Public Attributes

 BIN_SIZE
 

Private Attributes

 _all
 

Detailed Description

Definition at line 11 of file dqmMemoryStats.py.

Constructor & Destructor Documentation

◆ __init__()

def dqmMemoryStats.HistogramAnalyzer.__init__ (   self)

Definition at line 20 of file dqmMemoryStats.py.

20  def __init__(self):
21  self._all = {}
22 

Member Function Documentation

◆ analyze()

def dqmMemoryStats.HistogramAnalyzer.analyze (   self,
  fn,
  obj 
)

Definition at line 23 of file dqmMemoryStats.py.

23  def analyze(self, fn, obj):
24  name = fn.split("/")[-1]
25 
26  if hasattr(obj, 'ClassName'):
27  # this is a root type
28  t = str(obj.ClassName())
29  bin_size = self.BIN_SIZE.get(t, None)
30  if bin_size is None:
31  sys.stderr.write("warning: unknown root type: %s\n" % t)
32  sys.stderr.flush()
33  bin_size = 8
34 
35  bin_count = obj.GetNcells()
36  extra = len(fn)
37  total_bytes = bin_count * bin_size + extra
38 
39  self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes)
40  else:
41  t = str(type(obj))
42  #bin_count, bin_size, extra = 0, 0, len(str(obj)) + len(fn)
43  # assume constant size for strings
44  bin_count, bin_size, extra = 0, 0, 10 + len(fn)
45  total_bytes = bin_count * bin_size + extra
46 
47  self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes)
48 

References dqmMemoryStats.HistogramAnalyzer._all, dqmMemoryStats.HistogramAnalyzer.BIN_SIZE, dqmMemoryStats.HistogramEntry, and dqmMemoryStats.str.

◆ difference()

def dqmMemoryStats.HistogramAnalyzer.difference (   self,
  ref 
)

Definition at line 60 of file dqmMemoryStats.py.

60  def difference(self, ref):
61  results = HistogramAnalyzer()
62  results._all = dict(self._all)
63 
64  zero = HistogramEntry("null", 0, 0, 0, 0)
65  def cmp(a, b):
66  return HistogramEntry(b.type, b.bin_size,
67  a.bin_count - b.bin_count,
68  a.extra - b.extra,
69  a.total_bytes - b.total_bytes )
70 
71  for k, refv in ref._all.items():
72  results._all[k] = cmp(self._all.get(k, zero), refv)
73 
74  return results
75 
76 

References dqmMemoryStats.HistogramAnalyzer._all, fileCollector.cmp, and dqmMemoryStats.HistogramEntry.

◆ group()

def dqmMemoryStats.HistogramAnalyzer.group (   self,
  level,
  countObjects 
)

Definition at line 49 of file dqmMemoryStats.py.

49  def group(self, level, countObjects):
50  group_stats = {}
51 
52  for k, v in self._all.items():
53  group_key = "/".join(k.split("/")[:level])
54 
55  current = group_stats.get(group_key, 0)
56  group_stats[group_key] = current + (1 if countObjects else v.total_bytes)
57 
58  return group_stats
59 

References dqmMemoryStats.HistogramAnalyzer._all, mps_monitormerge.items, and join().

Member Data Documentation

◆ _all

dqmMemoryStats.HistogramAnalyzer._all
private

◆ BIN_SIZE

dqmMemoryStats.HistogramAnalyzer.BIN_SIZE
static

Definition at line 12 of file dqmMemoryStats.py.

Referenced by dqmMemoryStats.HistogramAnalyzer.analyze().

join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
dqmMemoryStats.HistogramEntry
HistogramEntry
Definition: dqmMemoryStats.py:9
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
str
#define str(s)
Definition: TestProcessor.cc:52
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
fileCollector.cmp
cmp
Definition: fileCollector.py:125
watchdog.group
group
Definition: watchdog.py:82