#include <DataFormats/HLTReco/interface/HLTPerformanceInfo.h>
Public Types | |
typedef std::vector< Module > | Modules |
typedef std::vector< size_t > | ModulesInPath |
typedef std::vector< Path > | PathList |
Public Member Functions | |
void | addModule (const Module &m) |
void | addModuleToPath (const size_t mod, const size_t path) |
void | addModuleToPath (const char *mod, const char *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 Module & | getModule (size_t m) const |
const Module & | getModuleOnPath (size_t m, size_t p) const |
const Path & | getPath (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_ |
Classes | |
class | Module |
class | Path |
Definition at line 11 of file HLTPerformanceInfo.h.
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.
HLTPerformanceInfo::HLTPerformanceInfo | ( | ) |
void HLTPerformanceInfo::addModuleToPath | ( | const size_t | mod, | |
const size_t | path | |||
) | [inline] |
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_.
00126 { 00127 // first make sure module exists 00128 Modules::iterator m = findModule(mod); 00129 if ( m == endModules() ) { 00130 // new module - create it and stick it on the end 00131 Module newMod(mod, 0, 0); // time (wall and cpu) = 0 since it wasn't run 00132 modules_.push_back(newMod); 00133 } 00134 00135 for ( size_t i = 0; i < paths_.size(); ++i ) { 00136 if ( !( paths_[i] == path ) ) continue; 00137 // we found the path, add module to the end 00138 for ( size_t j = 0; j < modules_.size(); ++j ) { 00139 if ( !(modules_[j] == mod) ) continue; 00140 paths_[i].addModuleRef(j); 00141 break; 00142 } 00143 break; 00144 } 00145 }
Modules::const_iterator HLTPerformanceInfo::beginModules | ( | ) | const [inline] |
Definition at line 188 of file HLTPerformanceInfo.h.
References modules_.
00188 { 00189 return modules_.begin(); 00190 }
PathList::iterator HLTPerformanceInfo::beginPaths | ( | ) | [inline] |
Definition at line 181 of file HLTPerformanceInfo.h.
References paths_.
00181 { 00182 return paths_.begin(); 00183 }
void HLTPerformanceInfo::clearModules | ( | ) | [inline] |
Modules::const_iterator HLTPerformanceInfo::endModules | ( | ) | const [inline] |
Definition at line 192 of file HLTPerformanceInfo.h.
References modules_.
Referenced by addModuleToPath().
00192 { 00193 return modules_.end(); 00194 }
PathList::iterator HLTPerformanceInfo::endPaths | ( | ) | [inline] |
Definition at line 184 of file HLTPerformanceInfo.h.
References paths_.
Referenced by moduleIndexInPath(), and setStatusOfModulesFromPath().
00184 { 00185 return paths_.end(); 00186 }
HLTPerformanceInfo::Modules::iterator HLTPerformanceInfo::findModule | ( | const char * | moduleInstanceName | ) |
Definition at line 19 of file HLTPerformanceInfo.cc.
References find(), and modules_.
Referenced by addModuleToPath().
HLTPerformanceInfo::PathList::iterator HLTPerformanceInfo::findPath | ( | const char * | pathName | ) |
Definition at line 12 of file HLTPerformanceInfo.cc.
References find(), edm::es::l(), and paths_.
Referenced by moduleIndexInPath(), and setStatusOfModulesFromPath().
00012 { 00013 PathList::iterator l = std::find(paths_.begin(), paths_.end(), 00014 pathName); 00015 return l; 00016 }
const Module& HLTPerformanceInfo::getModule | ( | size_t | m | ) | const [inline] |
const HLTPerformanceInfo::Module & HLTPerformanceInfo::getModuleOnPath | ( | size_t | m, | |
size_t | p | |||
) | const |
const Path& HLTPerformanceInfo::getPath | ( | size_t | p | ) | const [inline] |
double HLTPerformanceInfo::longestModuleCPUTime | ( | ) | const |
const char * HLTPerformanceInfo::longestModuleCPUTimeName | ( | ) | const |
Definition at line 102 of file HLTPerformanceInfo.cc.
References i, modules_, and t.
00103 { 00104 double t = -1; 00105 std::string slowpoke("unknown"); 00106 for ( Modules::const_iterator i = modules_.begin(); 00107 i != modules_.end(); ++i ) { 00108 if ( i->cputime() > t ) { 00109 slowpoke = i->name(); 00110 t = i->cputime(); 00111 } 00112 } 00113 return slowpoke.c_str(); 00114 }
double HLTPerformanceInfo::longestModuleTime | ( | ) | const |
const char * HLTPerformanceInfo::longestModuleTimeName | ( | ) | const |
Definition at line 88 of file HLTPerformanceInfo.cc.
References i, modules_, and t.
00089 { 00090 double t = -1; 00091 std::string slowpoke("unknown"); 00092 for ( Modules::const_iterator i = modules_.begin(); 00093 i != modules_.end(); ++i ) { 00094 if ( i->time() > t ) { 00095 slowpoke = i->name(); 00096 t = i->time(); 00097 } 00098 } 00099 return slowpoke.c_str(); 00100 }
int HLTPerformanceInfo::moduleIndexInPath | ( | const char * | mod, | |
const char * | path | |||
) |
Definition at line 156 of file HLTPerformanceInfo.cc.
References endPaths(), findPath(), j, modules_, and p.
00157 { 00158 PathList::iterator p = findPath(path); 00159 if ( p == endPaths() ) return -1; // Path doesn't exist 00160 int ctr = 0 ; 00161 for ( ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j ) { 00162 if ( modules_.at(*j) == mod ) return ctr ; 00163 ctr++ ; 00164 } 00165 return -2; // module not found on path 00166 }
size_t HLTPerformanceInfo::numberOfModules | ( | ) | const [inline] |
Definition at line 177 of file HLTPerformanceInfo.h.
References modules_.
00177 { 00178 return modules_.size(); 00179 }
size_t HLTPerformanceInfo::numberOfPaths | ( | ) | const [inline] |
Definition at line 174 of file HLTPerformanceInfo.h.
References paths_.
00174 { 00175 return paths_.size(); 00176 }
void HLTPerformanceInfo::setStatusOfModulesFromPath | ( | const char * | pathName | ) |
Definition at line 172 of file HLTPerformanceInfo.cc.
References endPaths(), findPath(), j, mod(), modules_, p, edm::hlt::Pass, edm::hlt::Ready, HLTPerformanceInfo::Module::setStatus(), HLTPerformanceInfo::Module::status(), and edm::HLTPathStatus::wasrun().
00173 { 00174 PathList::iterator p = findPath(pathName); 00175 if ( p == endPaths() ) { 00176 return; // do nothing 00177 } 00178 unsigned int ctr = 0; 00179 for ( ModulesInPath::const_iterator j = p->begin(); j != p->end(); ++j ) { 00180 edm::hlt::HLTState modState = edm::hlt::Ready ; 00181 unsigned int modIndex = 0 ; 00182 00183 // get module in the master list 00184 Module & mod = modules_.at(*j); 00185 00186 if ( ! mod.status().wasrun() ) { 00187 if (p->status().accept()) { 00188 modState = edm::hlt::Pass ; 00189 } else { 00190 if ( p->status().index() > ctr ) { 00191 modState = edm::hlt::Pass ; 00192 } else if ( p->status().index() == ctr ) { 00193 modState = p->status().state() ; 00194 } 00195 } 00196 mod.setStatus(edm::HLTPathStatus(modState,modIndex)) ; 00197 } 00198 ctr++ ; 00199 } 00200 00201 }
double HLTPerformanceInfo::totalCPUTime | ( | ) | const |
double HLTPerformanceInfo::totalPathCPUTime | ( | const size_t | path | ) |
Definition at line 55 of file HLTPerformanceInfo.cc.
References i, modules_, paths_, StDecayID::status, and t.
00056 { 00057 double t = 0; 00058 unsigned int cnt = 0; 00059 ModulesInPath::const_iterator i = paths_[pathnumber].begin(); 00060 for ( ; i != paths_[pathnumber].end(); ++i ) { 00061 if ( cnt > paths_[pathnumber].status().index()) break; 00062 ++cnt; 00063 t += modules_[*i].cputime(); 00064 } 00065 return t; 00066 }
double HLTPerformanceInfo::totalPathTime | ( | const size_t | path | ) |
Definition at line 42 of file HLTPerformanceInfo.cc.
References i, modules_, paths_, StDecayID::status, and t.
00043 { 00044 double t = 0; 00045 unsigned int cnt = 0; 00046 ModulesInPath::const_iterator i = paths_[pathnumber].begin(); 00047 for ( ; i != paths_[pathnumber].end(); ++i ) { 00048 if ( cnt > paths_[pathnumber].status().index()) break; 00049 ++cnt; 00050 t += modules_[*i].time(); 00051 } 00052 return t; 00053 }
double HLTPerformanceInfo::totalTime | ( | ) | const |
bool HLTPerformanceInfo::uniqueModule | ( | const char * | mod | ) | const |
Definition at line 140 of file HLTPerformanceInfo.cc.
References false, m, modules_, name, p, paths_, and true.
00140 { 00141 int mCtr = 0 ; 00142 for ( size_t p = 0; p < paths_.size(); ++p ) { 00143 for ( size_t m = 0; m < paths_[p].numberOfModules(); ++m ) { 00144 size_t modIndex = paths_[p].getModuleIndex(m); 00145 if ( modules_[modIndex].name() == std::string(mod) ) 00146 ++mCtr; 00147 if ( mCtr > 1 ) 00148 return false; 00149 } 00150 } 00151 00152 if (mCtr == 0) return false ; 00153 return true ; 00154 }
Modules HLTPerformanceInfo::modules_ [private] |
Definition at line 116 of file HLTPerformanceInfo.h.
Referenced by addModule(), addModuleToPath(), beginModules(), clear(), clearModules(), endModules(), findModule(), getModule(), getModuleOnPath(), HLTPerformanceInfo(), longestModuleCPUTime(), longestModuleCPUTimeName(), longestModuleTime(), longestModuleTimeName(), moduleIndexInPath(), numberOfModules(), setStatusOfModulesFromPath(), totalCPUTime(), totalPathCPUTime(), totalPathTime(), totalTime(), and uniqueModule().
PathList HLTPerformanceInfo::paths_ [private] |
Definition at line 115 of file HLTPerformanceInfo.h.
Referenced by addModuleToPath(), addPath(), beginPaths(), clear(), endPaths(), findPath(), getModuleOnPath(), getPath(), HLTPerformanceInfo(), numberOfPaths(), totalPathCPUTime(), totalPathTime(), and uniqueModule().