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 11 of file dqmMemoryStats.py.

Constructor & Destructor Documentation

def dqmMemoryStats.HistogramAnalyzer.__init__ (   self)

Definition at line 20 of file dqmMemoryStats.py.

Member Function Documentation

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

Definition at line 23 of file dqmMemoryStats.py.

References dqmMemoryStats.HistogramAnalyzer._all, and str.

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 
#define str(s)
def dqmMemoryStats.HistogramAnalyzer.difference (   self,
  ref 
)

Definition at line 60 of file dqmMemoryStats.py.

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

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 
def dqmMemoryStats.HistogramAnalyzer.group (   self,
  level,
  countObjects 
)

Definition at line 49 of file dqmMemoryStats.py.

References join().

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 
def group(self, level, countObjects)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Data Documentation

dqmMemoryStats.HistogramAnalyzer._all
private