CMS 3D CMS Logo

List of all members | Public Member Functions | 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)
 

Private Attributes

 _all
 

Detailed Description

Definition at line 10 of file dqmMemoryStats.py.

Constructor & Destructor Documentation

def dqmMemoryStats.HistogramAnalyzer.__init__ (   self)

Definition at line 19 of file dqmMemoryStats.py.

Member Function Documentation

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

Definition at line 22 of file dqmMemoryStats.py.

References dqmMemoryStats.HistogramAnalyzer._all, and harvestTrackValidationPlots.str.

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

Definition at line 57 of file dqmMemoryStats.py.

References dqmMemoryStats.HistogramAnalyzer._all, and cmsPerfStripChart.dict.

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

Definition at line 46 of file dqmMemoryStats.py.

References join().

46  def group(self, level):
47  group_stats = {}
48 
49  for k, v in self._all.items():
50  group_key = "/".join(k.split("/")[:level])
51 
52  current = group_stats.get(group_key, 0)
53  group_stats[group_key] = current + v.total_bytes
54 
55  return group_stats
56 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Data Documentation

dqmMemoryStats.HistogramAnalyzer._all
private