CMS 3D CMS Logo

HLTPerformanceInfo Class Reference

#include <DataFormats/HLTReco/interface/HLTPerformanceInfo.h>

List of all members.

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 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 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_

Classes

class  Module
class  Path


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_.

00007                                        {
00008   paths_.clear(); modules_.clear();
00009 }


Member Function Documentation

void HLTPerformanceInfo::addModule ( const Module m  )  [inline]

Definition at line 122 of file HLTPerformanceInfo.h.

References modules_.

00122                                     {
00123     modules_.push_back(m);
00124   } 

void HLTPerformanceInfo::addModuleToPath ( const size_t  mod,
const size_t  path 
) [inline]

Definition at line 147 of file HLTPerformanceInfo.h.

References modules_, and paths_.

00147                                                             {
00148     assert(( path <paths_.size()) && (mod < modules_.size()) );
00149     paths_[path].addModuleRef(mod);
00150   }

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    }

void HLTPerformanceInfo::addPath ( const Path p  )  [inline]

Definition at line 119 of file HLTPerformanceInfo.h.

References paths_.

00119                                {
00120     paths_.push_back(p);
00121   }

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::clear ( void   )  [inline]

Definition at line 152 of file HLTPerformanceInfo.h.

References modules_, and paths_.

00152                {
00153     modules_.clear(); paths_.clear();
00154   }

void HLTPerformanceInfo::clearModules (  )  [inline]

Definition at line 155 of file HLTPerformanceInfo.h.

References i, and modules_.

00155                       {
00156     for ( size_t i = 0; i < modules_.size(); ++i ) {
00157       modules_[i].clear();
00158     }
00159   }

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().

00019                                                              {
00020   return std::find(modules_.begin(), modules_.end(),
00021                    moduleInstanceName);
00022 }

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]

Definition at line 163 of file HLTPerformanceInfo.h.

References modules_.

00163 { 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_, and paths_.

00132 {
00133   // well if this doesn't get your attention....
00134   assert(p<paths_.size()&& m<paths_[p].numberOfModules());
00135   size_t j = paths_[p].getModuleIndex(m);
00136   return modules_.at(j);
00137 }

const Path& HLTPerformanceInfo::getPath ( size_t  p  )  const [inline]

Definition at line 164 of file HLTPerformanceInfo.h.

References paths_.

00164 { return paths_.at(p); }

double HLTPerformanceInfo::longestModuleCPUTime (  )  const

Definition at line 79 of file HLTPerformanceInfo.cc.

References i, max, modules_, and t.

00079                                                       {
00080   double t = -1;
00081   for ( Modules::const_iterator i = modules_.begin();
00082         i != modules_.end(); ++i ) {
00083     t = std::max(i->cputime(),t);
00084   }
00085   return t;
00086 }

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

Definition at line 70 of file HLTPerformanceInfo.cc.

References i, max, modules_, and t.

00070                                                    {
00071   double t = -1;
00072   for ( Modules::const_iterator i = modules_.begin();
00073         i != modules_.end(); ++i ) {
00074     t = std::max(i->time(),t);
00075   }
00076   return t;
00077 }

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

Definition at line 34 of file HLTPerformanceInfo.cc.

References i, modules_, and t.

00034                                               {
00035   double t = 0;
00036   for ( size_t i = 0; i < modules_.size(); ++i ) {
00037     t += modules_[i].cputime();
00038   }
00039   return t;
00040 }

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

Definition at line 26 of file HLTPerformanceInfo.cc.

References i, modules_, and t.

00026                                            {
00027   double t = 0;
00028   for ( size_t i = 0; i < modules_.size(); ++i ) {
00029     t += modules_[i].time();
00030   }
00031   return t;
00032 }

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 }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:39 2009 for CMSSW by  doxygen 1.5.4