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, countObjects)
 

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 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  # assume constant size for strings
43  bin_count, bin_size, extra = 0, 0, 10 + len(fn)
44  total_bytes = bin_count * bin_size + extra
45 
46  self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes)
47 
#define str(s)
def dqmMemoryStats.HistogramAnalyzer.difference (   self,
  ref 
)

Definition at line 59 of file dqmMemoryStats.py.

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

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

Definition at line 48 of file dqmMemoryStats.py.

References join().

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

Member Data Documentation

dqmMemoryStats.HistogramAnalyzer._all
private