CMS 3D CMS Logo

HLTPerformanceInfo.cc
Go to the documentation of this file.
1 
4 #include <algorithm>
5 
7  paths_.clear();
8  modules_.clear();
9 }
10 
11 HLTPerformanceInfo::PathList::iterator HLTPerformanceInfo::findPath(const char* pathName) {
12  PathList::iterator l = std::find(paths_.begin(), paths_.end(), pathName);
13  return l;
14 }
15 
16 HLTPerformanceInfo::Modules::iterator HLTPerformanceInfo::findModule(const char* moduleInstanceName) {
17  return std::find(modules_.begin(), modules_.end(), moduleInstanceName);
18 }
19 
21  double t = 0;
22  for (size_t i = 0; i < modules_.size(); ++i) {
23  t += modules_[i].time();
24  }
25  return t;
26 }
27 
29  double t = 0;
30  for (size_t i = 0; i < modules_.size(); ++i) {
31  t += modules_[i].cputime();
32  }
33  return t;
34 }
35 
36 double HLTPerformanceInfo::totalPathTime(const size_t pathnumber) {
37  double t = 0;
38  unsigned int cnt = 0;
39  ModulesInPath::const_iterator i = paths_[pathnumber].begin();
40  for (; i != paths_[pathnumber].end(); ++i) {
41  if (cnt > paths_[pathnumber].status().index())
42  break;
43  ++cnt;
44  t += modules_[*i].time();
45  }
46  return t;
47 }
48 
49 double HLTPerformanceInfo::totalPathCPUTime(const size_t pathnumber) {
50  double t = 0;
51  unsigned int cnt = 0;
52  ModulesInPath::const_iterator i = paths_[pathnumber].begin();
53  for (; i != paths_[pathnumber].end(); ++i) {
54  if (cnt > paths_[pathnumber].status().index())
55  break;
56  ++cnt;
57  t += modules_[*i].cputime();
58  }
59  return t;
60 }
61 
63  double t = -1;
64  for (Modules::const_iterator i = modules_.begin(); i != modules_.end(); ++i) {
65  t = std::max(i->time(), t);
66  }
67  return t;
68 }
69 
71  double t = -1;
72  for (Modules::const_iterator i = modules_.begin(); i != modules_.end(); ++i) {
73  t = std::max(i->cputime(), t);
74  }
75  return t;
76 }
77 
79  double t = -1;
80  std::string slowpoke("unknown");
81  for (Modules::const_iterator i = modules_.begin(); i != modules_.end(); ++i) {
82  if (i->time() > t) {
83  slowpoke = i->name();
84  t = i->time();
85  }
86  }
87  return slowpoke;
88 }
89 
91  double t = -1;
92  std::string slowpoke("unknown");
93  for (Modules::const_iterator i = modules_.begin(); i != modules_.end(); ++i) {
94  if (i->cputime() > t) {
95  slowpoke = i->name();
96  t = i->cputime();
97  }
98  }
99  return slowpoke;
100 }
101 
102 // I think we can no longer do this as it requires going from path -> modules
103 // int HLTPerformanceInfo::Module::indexInPath(Path path) const
104 // {
105 // int ctr = 0 ;
106 // ModulesInPath::const_iterator iter = path.begin();
107 // for ( ; iter != path.end(); ++iter ) {
108 // if (modules_[*iter].name() == this->name()) return ctr ;
109 // ctr++ ;
110 // }
111 // //--- Module not found in path ---
112 // return -1 ;
113 // }
114 
116  // well if this doesn't get your attention....
117  assert(p < paths_.size() && m < paths_[p].numberOfModules());
118  size_t j = paths_[p].getModuleIndex(m);
119  return modules_.at(j);
120 }
121 
122 bool HLTPerformanceInfo::uniqueModule(const char* mod) const {
123  int mCtr = 0;
124  for (size_t p = 0; p < paths_.size(); ++p) {
125  for (size_t m = 0; m < paths_[p].numberOfModules(); ++m) {
126  size_t modIndex = paths_[p].getModuleIndex(m);
127  if (modules_[modIndex].name() == std::string(mod))
128  ++mCtr;
129  if (mCtr > 1)
130  return false;
131  }
132  }
133 
134  if (mCtr == 0)
135  return false;
136  return true;
137 }
138 
139 int HLTPerformanceInfo::moduleIndexInPath(const char* mod, const char* path) {
140  PathList::iterator p = findPath(path);
141  if (p == endPaths())
142  return -1; // Path doesn't exist
143  int ctr = 0;
144  for (ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j) {
145  if (modules_.at(*j) == mod)
146  return ctr;
147  ctr++;
148  }
149  return -2; // module not found on path
150 }
151 
152 // Set the status of the module based on the path's status
153 // make sure not to wipe out ones that come after the last
154 // module run on the particular path
156  PathList::iterator p = findPath(pathName);
157  if (p == endPaths()) {
158  return; // do nothing
159  }
160  unsigned int ctr = 0;
161  for (ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j) {
163  unsigned int modIndex = 0;
164 
165  // get module in the master list
166  Module& mod = modules_.at(*j);
167 
168  if (!mod.status().wasrun()) {
169  if (p->status().accept()) {
170  modState = edm::hlt::Pass;
171  } else {
172  if (p->status().index() > ctr) {
173  modState = edm::hlt::Pass;
174  } else if (p->status().index() == ctr) {
175  modState = p->status().state();
176  }
177  }
178  mod.setStatus(edm::HLTPathStatus(modState, modIndex));
179  }
180  ctr++;
181  }
182 }
HLTPerformanceInfo::totalTime
double totalTime() const
Definition: HLTPerformanceInfo.cc:20
edm::hlt::HLTState
HLTState
status of a trigger path
Definition: HLTenums.h:16
HLTPerformanceInfo::totalPathCPUTime
double totalPathCPUTime(const size_t path)
Definition: HLTPerformanceInfo.cc:49
HLTPerformanceInfo::longestModuleCPUTime
double longestModuleCPUTime() const
Definition: HLTPerformanceInfo.cc:70
mps_fire.i
i
Definition: mps_fire.py:428
HLTPerformanceInfo::uniqueModule
bool uniqueModule(const char *mod) const
Definition: HLTPerformanceInfo.cc:122
mps_update.status
status
Definition: mps_update.py:69
HLTPerformanceInfo::getModuleOnPath
const Module & getModuleOnPath(size_t m, size_t p) const
Definition: HLTPerformanceInfo.cc:115
HLTPerformanceInfo::endPaths
PathList::iterator endPaths()
Definition: HLTPerformanceInfo.h:146
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
cms::cuda::assert
assert(be >=bs)
HLTPerformanceInfo::longestModuleTime
double longestModuleTime() const
Definition: HLTPerformanceInfo.cc:62
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HLTPerformanceInfo::HLTPerformanceInfo
HLTPerformanceInfo()
Definition: HLTPerformanceInfo.cc:6
HLTPerformanceInfo::longestModuleCPUTimeName
std::string longestModuleCPUTimeName() const
Definition: HLTPerformanceInfo.cc:90
HLTPerformanceInfo::findPath
PathList::iterator findPath(const char *pathName)
Definition: HLTPerformanceInfo.cc:11
hltMonBTagIPClient_cfi.pathName
pathName
Definition: hltMonBTagIPClient_cfi.py:5
HLTPerformanceInfo.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
HLTPerformanceInfo::totalPathTime
double totalPathTime(const size_t path)
Definition: HLTPerformanceInfo.cc:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLTPerformanceInfo::totalCPUTime
double totalCPUTime() const
Definition: HLTPerformanceInfo.cc:28
dqmiodatasetharvest.ctr
ctr
Definition: dqmiodatasetharvest.py:191
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HLTPerformanceInfo::Module
Definition: HLTPerformanceInfo.h:21
HLTPerformanceInfo::setStatusOfModulesFromPath
void setStatusOfModulesFromPath(const char *pathName)
Definition: HLTPerformanceInfo.cc:155
edm::HLTPathStatus
Definition: HLTPathStatus.h:33
edm::hlt::Ready
not [yet] run
Definition: HLTenums.h:17
HLTPerformanceInfo::findModule
Modules::iterator findModule(const char *moduleInstanceName)
Definition: HLTPerformanceInfo.cc:16
HLTPerformanceInfo::moduleIndexInPath
int moduleIndexInPath(const char *mod, const char *path)
Definition: HLTPerformanceInfo.cc:139
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
HLTPerformanceInfo::modules_
Modules modules_
Definition: HLTPerformanceInfo.h:86
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HLTenums.h
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
HLTPerformanceInfo::paths_
PathList paths_
Definition: HLTPerformanceInfo.h:85
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::hlt::Pass
accept
Definition: HLTenums.h:18
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
HLTPerformanceInfo::longestModuleTimeName
std::string longestModuleTimeName() const
Definition: HLTPerformanceInfo.cc:78