test
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< cms_uint32_tModulesInPath
 
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.

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 6 of file HLTPerformanceInfo.cc.

References modules_, and paths_.

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

Member Function Documentation

void HLTPerformanceInfo::addModule ( const Module m)
inline

Definition at line 122 of file HLTPerformanceInfo.h.

References modules_.

void HLTPerformanceInfo::addModuleToPath ( const char *  mod,
const char *  path 
)
inline

Definition at line 126 of file HLTPerformanceInfo.h.

References endModules(), findModule(), i, j, visualization-live-secondInstance_cfg::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:201
int j
Definition: DBlmapReader.cc:9
Modules::iterator findModule(const char *moduleInstanceName)
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void HLTPerformanceInfo::addModuleToPath ( const size_t  mod,
const size_t  path 
)
inline

Definition at line 147 of file HLTPerformanceInfo.h.

References assert(), modules_, fed_dqm_sourceclient-live_cfg::path, and paths_.

147  {
148  assert(( path <paths_.size()) && (mod < modules_.size()) );
149  paths_[path].addModuleRef(mod);
150  }
assert(m_qm.get())
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
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 18 of file HLTPerformanceInfo.cc.

References spr::find(), and modules_.

Referenced by addModuleToPath().

18  {
19  return std::find(modules_.begin(), modules_.end(),
20  moduleInstanceName);
21 }
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 11 of file HLTPerformanceInfo.cc.

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

Referenced by moduleIndexInPath(), and setStatusOfModulesFromPath().

11  {
12  PathList::iterator l = std::find(paths_.begin(), paths_.end(),
13  pathName);
14  return l;
15 }
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_.

const HLTPerformanceInfo::Module & HLTPerformanceInfo::getModuleOnPath ( size_t  m,
size_t  p 
) const

Definition at line 129 of file HLTPerformanceInfo.cc.

References assert(), j, modules_, AlCaHLTBitMon_ParallelJobs::p, and paths_.

131 {
132  // well if this doesn't get your attention....
133  assert(p<paths_.size()&& m<paths_[p].numberOfModules());
134  size_t j = paths_[p].getModuleIndex(m);
135  return modules_.at(j);
136 }
assert(m_qm.get())
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 78 of file HLTPerformanceInfo.cc.

References i, bookConverter::max, modules_, and lumiQTWidget::t.

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

Definition at line 101 of file HLTPerformanceInfo.cc.

References i, modules_, AlCaHLTBitMon_QueryRunRegistry::string, and lumiQTWidget::t.

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

Definition at line 69 of file HLTPerformanceInfo.cc.

References i, bookConverter::max, modules_, and lumiQTWidget::t.

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

Definition at line 87 of file HLTPerformanceInfo.cc.

References i, modules_, AlCaHLTBitMon_QueryRunRegistry::string, and lumiQTWidget::t.

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

Definition at line 155 of file HLTPerformanceInfo.cc.

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

156 {
157  PathList::iterator p = findPath(path);
158  if ( p == endPaths() ) return -1; // Path doesn't exist
159  int ctr = 0 ;
160  for ( ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j ) {
161  if ( modules_.at(*j) == mod ) return ctr ;
162  ctr++ ;
163  }
164  return -2; // module not found on path
165 }
PathList::iterator findPath(const char *pathName)
PathList::iterator endPaths()
int j
Definition: DBlmapReader.cc:9
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
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 171 of file HLTPerformanceInfo.cc.

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

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

Definition at line 33 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

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

Definition at line 54 of file HLTPerformanceInfo.cc.

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

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

Definition at line 41 of file HLTPerformanceInfo.cc.

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

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

Definition at line 25 of file HLTPerformanceInfo.cc.

References i, modules_, and lumiQTWidget::t.

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

Definition at line 139 of file HLTPerformanceInfo.cc.

References edm::false, visualization-live-secondInstance_cfg::m, modules_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, paths_, AlCaHLTBitMon_QueryRunRegistry::string, and funct::true.

139  {
140  int mCtr = 0 ;
141  for ( size_t p = 0; p < paths_.size(); ++p ) {
142  for ( size_t m = 0; m < paths_[p].numberOfModules(); ++m ) {
143  size_t modIndex = paths_[p].getModuleIndex(m);
144  if ( modules_[modIndex].name() == std::string(mod) )
145  ++mCtr;
146  if ( mCtr > 1 )
147  return false;
148  }
149  }
150 
151  if (mCtr == 0) return false ;
152  return true ;
153 }
volatile std::atomic< bool > shutdown_flag false
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

Member Data Documentation

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