CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
HLTPerformanceInfo Class Reference

#include <HLTPerformanceInfo.h>

Classes

class  Module
 
class  Path
 

Public Types

typedef std::vector< ModuleModules
 
typedef std::vector< size_t > ModulesInPath
 
typedef std::vector< PathPathList
 

Public Member Functions

void addModule (const Module &m)
 
void addModuleToPath (const char *mod, const char *path)
 
void addModuleToPath (const size_t mod, const size_t path)
 
void addPath (const Path &p)
 
Modules::const_iterator beginModules () const
 
PathList::iterator beginPaths ()
 
void clear ()
 
void clearModules ()
 
Modules::const_iterator endModules () const
 
PathList::iterator endPaths ()
 
Modules::iterator findModule (const char *moduleInstanceName)
 
PathList::iterator findPath (const char *pathName)
 
const ModulegetModule (size_t m) const
 
const ModulegetModuleOnPath (size_t m, size_t p) const
 
const PathgetPath (size_t p) const
 
 HLTPerformanceInfo ()
 
double longestModuleCPUTime () const
 
const char * longestModuleCPUTimeName () const
 
double longestModuleTime () const
 
const char * longestModuleTimeName () const
 
int moduleIndexInPath (const char *mod, const char *path)
 
size_t numberOfModules () const
 
size_t numberOfPaths () const
 
void setStatusOfModulesFromPath (const char *pathName)
 
double totalCPUTime () const
 
double totalPathCPUTime (const size_t path)
 
double totalPathTime (const size_t path)
 
double totalTime () const
 
bool uniqueModule (const char *mod) const
 

Private Attributes

Modules modules_
 
PathList paths_
 

Detailed Description

Definition at line 11 of file HLTPerformanceInfo.h.

Member Typedef Documentation

typedef std::vector<Module> HLTPerformanceInfo::Modules

Definition at line 16 of file HLTPerformanceInfo.h.

typedef std::vector<size_t> HLTPerformanceInfo::ModulesInPath

Definition at line 17 of file HLTPerformanceInfo.h.

typedef std::vector<Path> HLTPerformanceInfo::PathList

Definition at line 14 of file HLTPerformanceInfo.h.

Constructor & Destructor Documentation

HLTPerformanceInfo::HLTPerformanceInfo ( )

Definition at line 7 of file HLTPerformanceInfo.cc.

References modules_, and paths_.

7  {
8  paths_.clear(); modules_.clear();
9 }

Member Function Documentation

void HLTPerformanceInfo::addModule ( const Module m)
inline

Definition at line 122 of file HLTPerformanceInfo.h.

References modules_.

122  {
123  modules_.push_back(m);
124  }
void HLTPerformanceInfo::addModuleToPath ( const char *  mod,
const char *  path 
)
inline

Definition at line 126 of file HLTPerformanceInfo.h.

References endModules(), findModule(), i, j, m, modules_, and paths_.

126  {
127  // first make sure module exists
128  Modules::iterator m = findModule(mod);
129  if ( m == endModules() ) {
130  // new module - create it and stick it on the end
131  Module newMod(mod, 0, 0); // time (wall and cpu) = 0 since it wasn't run
132  modules_.push_back(newMod);
133  }
134 
135  for ( size_t i = 0; i < paths_.size(); ++i ) {
136  if ( !( paths_[i] == path ) ) continue;
137  // we found the path, add module to the end
138  for ( size_t j = 0; j < modules_.size(); ++j ) {
139  if ( !(modules_[j] == mod) ) continue;
140  paths_[i].addModuleRef(j);
141  break;
142  }
143  break;
144  }
145  }
int i
Definition: DBlmapReader.cc:9
Modules::const_iterator endModules() const
#define Module(md)
Definition: vmac.h:202
list path
Definition: scaleCards.py:51
int j
Definition: DBlmapReader.cc:9
list mod
Load physics model.
Modules::iterator findModule(const char *moduleInstanceName)
void HLTPerformanceInfo::addModuleToPath ( const size_t  mod,
const size_t  path 
)
inline

Definition at line 147 of file HLTPerformanceInfo.h.

References modules_, scaleCards::path, and paths_.

147  {
148  assert(( path <paths_.size()) && (mod < modules_.size()) );
149  paths_[path].addModuleRef(mod);
150  }
list path
Definition: scaleCards.py:51
list mod
Load physics model.
void HLTPerformanceInfo::addPath ( const Path p)
inline

Definition at line 119 of file HLTPerformanceInfo.h.

References paths_.

119  {
120  paths_.push_back(p);
121  }
Modules::const_iterator HLTPerformanceInfo::beginModules ( ) const
inline

Definition at line 188 of file HLTPerformanceInfo.h.

References modules_.

188  {
189  return modules_.begin();
190  }
PathList::iterator HLTPerformanceInfo::beginPaths ( )
inline

Definition at line 181 of file HLTPerformanceInfo.h.

References paths_.

181  {
182  return paths_.begin();
183  }
void HLTPerformanceInfo::clear ( void  )
inline
void HLTPerformanceInfo::clearModules ( )
inline

Definition at line 155 of file HLTPerformanceInfo.h.

References i, and modules_.

155  {
156  for ( size_t i = 0; i < modules_.size(); ++i ) {
157  modules_[i].clear();
158  }
159  }
int i
Definition: DBlmapReader.cc:9
Modules::const_iterator HLTPerformanceInfo::endModules ( ) const
inline

Definition at line 192 of file HLTPerformanceInfo.h.

References modules_.

Referenced by addModuleToPath().

192  {
193  return modules_.end();
194  }
PathList::iterator HLTPerformanceInfo::endPaths ( )
inline

Definition at line 184 of file HLTPerformanceInfo.h.

References paths_.

Referenced by moduleIndexInPath(), and setStatusOfModulesFromPath().

184  {
185  return paths_.end();
186  }
HLTPerformanceInfo::Modules::iterator HLTPerformanceInfo::findModule ( const char *  moduleInstanceName)

Definition at line 19 of file HLTPerformanceInfo.cc.

References spr::find(), and modules_.

Referenced by addModuleToPath().

19  {
20  return std::find(modules_.begin(), modules_.end(),
21  moduleInstanceName);
22 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
HLTPerformanceInfo::PathList::iterator HLTPerformanceInfo::findPath ( const char *  pathName)

Definition at line 12 of file HLTPerformanceInfo.cc.

References spr::find(), prof2calltree::l, EgammaValidation_cff::pathName, and paths_.

Referenced by moduleIndexInPath(), and setStatusOfModulesFromPath().

12  {
13  PathList::iterator l = std::find(paths_.begin(), paths_.end(),
14  pathName);
15  return l;
16 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const Module& HLTPerformanceInfo::getModule ( size_t  m) const
inline

Definition at line 163 of file HLTPerformanceInfo.h.

References modules_.

163 { return modules_.at(m); }
const HLTPerformanceInfo::Module & HLTPerformanceInfo::getModuleOnPath ( size_t  m,
size_t  p 
) const

Definition at line 130 of file HLTPerformanceInfo.cc.

References j, modules_, AlCaHLTBitMon_ParallelJobs::p, and paths_.

132 {
133  // well if this doesn't get your attention....
134  assert(p<paths_.size()&& m<paths_[p].numberOfModules());
135  size_t j = paths_[p].getModuleIndex(m);
136  return modules_.at(j);
137 }
int j
Definition: DBlmapReader.cc:9
const Path& HLTPerformanceInfo::getPath ( size_t  p) const
inline

Definition at line 164 of file HLTPerformanceInfo.h.

References paths_.

double HLTPerformanceInfo::longestModuleCPUTime ( ) const

Definition at line 79 of file HLTPerformanceInfo.cc.

References i, max(), modules_, and lumiQTWidget::t.

79  {
80  double t = -1;
81  for ( Modules::const_iterator i = modules_.begin();
82  i != modules_.end(); ++i ) {
83  t = std::max(i->cputime(),t);
84  }
85  return t;
86 }
int i
Definition: DBlmapReader.cc:9
const T & max(const T &a, const T &b)
const char * HLTPerformanceInfo::longestModuleCPUTimeName ( ) const

Definition at line 102 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

103 {
104  double t = -1;
105  std::string slowpoke("unknown");
106  for ( Modules::const_iterator i = modules_.begin();
107  i != modules_.end(); ++i ) {
108  if ( i->cputime() > t ) {
109  slowpoke = i->name();
110  t = i->cputime();
111  }
112  }
113  return slowpoke.c_str();
114 }
int i
Definition: DBlmapReader.cc:9
double HLTPerformanceInfo::longestModuleTime ( ) const

Definition at line 70 of file HLTPerformanceInfo.cc.

References i, max(), modules_, and lumiQTWidget::t.

70  {
71  double t = -1;
72  for ( Modules::const_iterator i = modules_.begin();
73  i != modules_.end(); ++i ) {
74  t = std::max(i->time(),t);
75  }
76  return t;
77 }
int i
Definition: DBlmapReader.cc:9
const T & max(const T &a, const T &b)
const char * HLTPerformanceInfo::longestModuleTimeName ( ) const

Definition at line 88 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

89 {
90  double t = -1;
91  std::string slowpoke("unknown");
92  for ( Modules::const_iterator i = modules_.begin();
93  i != modules_.end(); ++i ) {
94  if ( i->time() > t ) {
95  slowpoke = i->name();
96  t = i->time();
97  }
98  }
99  return slowpoke.c_str();
100 }
int i
Definition: DBlmapReader.cc:9
int HLTPerformanceInfo::moduleIndexInPath ( const char *  mod,
const char *  path 
)

Definition at line 156 of file HLTPerformanceInfo.cc.

References endPaths(), findPath(), j, text2workspace::mod, modules_, and AlCaHLTBitMon_ParallelJobs::p.

157 {
158  PathList::iterator p = findPath(path);
159  if ( p == endPaths() ) return -1; // Path doesn't exist
160  int ctr = 0 ;
161  for ( ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j ) {
162  if ( modules_.at(*j) == mod ) return ctr ;
163  ctr++ ;
164  }
165  return -2; // module not found on path
166 }
PathList::iterator findPath(const char *pathName)
list path
Definition: scaleCards.py:51
PathList::iterator endPaths()
int j
Definition: DBlmapReader.cc:9
list mod
Load physics model.
size_t HLTPerformanceInfo::numberOfModules ( ) const
inline

Definition at line 177 of file HLTPerformanceInfo.h.

References modules_.

177  {
178  return modules_.size();
179  }
size_t HLTPerformanceInfo::numberOfPaths ( ) const
inline

Definition at line 174 of file HLTPerformanceInfo.h.

References paths_.

174  {
175  return paths_.size();
176  }
void HLTPerformanceInfo::setStatusOfModulesFromPath ( const char *  pathName)

Definition at line 172 of file HLTPerformanceInfo.cc.

References endPaths(), findPath(), j, text2workspace::mod, modules_, AlCaHLTBitMon_ParallelJobs::p, edm::hlt::Pass, edm::hlt::Ready, HLTPerformanceInfo::Module::setStatus(), HLTPerformanceInfo::Module::status(), and edm::HLTPathStatus::wasrun().

173 {
174  PathList::iterator p = findPath(pathName);
175  if ( p == endPaths() ) {
176  return; // do nothing
177  }
178  unsigned int ctr = 0;
179  for ( ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j ) {
180  edm::hlt::HLTState modState = edm::hlt::Ready ;
181  unsigned int modIndex = 0 ;
182 
183  // get module in the master list
184  Module & mod = modules_.at(*j);
185 
186  if ( ! mod.status().wasrun() ) {
187  if (p->status().accept()) {
188  modState = edm::hlt::Pass ;
189  } else {
190  if ( p->status().index() > ctr ) {
191  modState = edm::hlt::Pass ;
192  } else if ( p->status().index() == ctr ) {
193  modState = p->status().state() ;
194  }
195  }
196  mod.setStatus(edm::HLTPathStatus(modState,modIndex)) ;
197  }
198  ctr++ ;
199  }
200 
201 }
PathList::iterator findPath(const char *pathName)
not [yet] run
Definition: HLTenums.h:21
HLTState
status of a trigger path
Definition: HLTenums.h:21
#define Module(md)
Definition: vmac.h:202
accept
Definition: HLTenums.h:22
PathList::iterator endPaths()
int j
Definition: DBlmapReader.cc:9
list mod
Load physics model.
double HLTPerformanceInfo::totalCPUTime ( ) const

Definition at line 34 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

34  {
35  double t = 0;
36  for ( size_t i = 0; i < modules_.size(); ++i ) {
37  t += modules_[i].cputime();
38  }
39  return t;
40 }
int i
Definition: DBlmapReader.cc:9
double HLTPerformanceInfo::totalPathCPUTime ( const size_t  path)

Definition at line 55 of file HLTPerformanceInfo.cc.

References i, modules_, paths_, ntuplemaker::status, and lumiQTWidget::t.

56 {
57  double t = 0;
58  unsigned int cnt = 0;
59  ModulesInPath::const_iterator i = paths_[pathnumber].begin();
60  for ( ; i != paths_[pathnumber].end(); ++i ) {
61  if ( cnt > paths_[pathnumber].status().index()) break;
62  ++cnt;
63  t += modules_[*i].cputime();
64  }
65  return t;
66 }
int i
Definition: DBlmapReader.cc:9
tuple status
Definition: ntuplemaker.py:245
double HLTPerformanceInfo::totalPathTime ( const size_t  path)

Definition at line 42 of file HLTPerformanceInfo.cc.

References i, modules_, paths_, ntuplemaker::status, and lumiQTWidget::t.

43 {
44  double t = 0;
45  unsigned int cnt = 0;
46  ModulesInPath::const_iterator i = paths_[pathnumber].begin();
47  for ( ; i != paths_[pathnumber].end(); ++i ) {
48  if ( cnt > paths_[pathnumber].status().index()) break;
49  ++cnt;
50  t += modules_[*i].time();
51  }
52  return t;
53 }
int i
Definition: DBlmapReader.cc:9
tuple status
Definition: ntuplemaker.py:245
double HLTPerformanceInfo::totalTime ( ) const

Definition at line 26 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

26  {
27  double t = 0;
28  for ( size_t i = 0; i < modules_.size(); ++i ) {
29  t += modules_[i].time();
30  }
31  return t;
32 }
int i
Definition: DBlmapReader.cc:9
bool HLTPerformanceInfo::uniqueModule ( const char *  mod) const

Definition at line 140 of file HLTPerformanceInfo.cc.

References funct::false, m, modules_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, paths_, and funct::true.

140  {
141  int mCtr = 0 ;
142  for ( size_t p = 0; p < paths_.size(); ++p ) {
143  for ( size_t m = 0; m < paths_[p].numberOfModules(); ++m ) {
144  size_t modIndex = paths_[p].getModuleIndex(m);
145  if ( modules_[modIndex].name() == std::string(mod) )
146  ++mCtr;
147  if ( mCtr > 1 )
148  return false;
149  }
150  }
151 
152  if (mCtr == 0) return false ;
153  return true ;
154 }
list mod
Load physics model.

Member Data Documentation

Modules HLTPerformanceInfo::modules_
private
PathList HLTPerformanceInfo::paths_
private