Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

SequencerTimerTool.h

Go to the documentation of this file.
00001 // $Id: SequencerTimerTool.h,v 1.7 2005/07/29 16:49:43 hmd Exp $
00002 #ifndef SEQUENCERTIMERTOOL_H 
00003 #define SEQUENCERTIMERTOOL_H 1
00004 
00005 // Include files
00006 // from Gaudi
00007 #include "GaudiAlg/GaudiTool.h"
00008 #include "GaudiAlg/ISequencerTimerTool.h"
00009 
00010 // local
00011 #include "TimerForSequencer.h"
00012 
00013 
00027 class SequencerTimerTool : public GaudiTool, virtual public ISequencerTimerTool{
00028 public: 
00029 
00031   SequencerTimerTool( const std::string& type, 
00032                       const std::string& name,
00033                       const IInterface* parent);
00034 
00035   virtual ~SequencerTimerTool( ); 
00036 
00038   virtual StatusCode initialize();
00039 
00041   virtual StatusCode finalize();
00042 
00044   virtual int addTimer( std::string name ) {
00045     std::string myName;
00046     if ( 0 < m_indent ) {
00047       std::string prefix( m_indent, ' ' );
00048       myName += prefix;
00049     }
00050     std::string space( m_headerSize, ' ' );
00051     myName += name + space ;
00052     myName = myName.substr( 0, m_headerSize );
00053     
00054     m_timerList.push_back( TimerForSequencer(myName, m_normFactor) );
00055     return m_timerList.size() -1;
00056   };
00057 
00059   virtual void increaseIndent()    { m_indent += 2; };
00060 
00062   virtual void decreaseIndent()    { 
00063     m_indent -= 2; 
00064     if ( 0 > m_indent ) m_indent = 0; 
00065   };
00066 
00068   void start( int index )  {   m_timerList[index].start();  };
00069 
00071   double stop( int index )  {   return m_timerList[index].stop();  };
00072  
00074   double lastTime( int index )  {   return m_timerList[index].lastTime();  };
00075 
00077   std::string name( int index )  {   return m_timerList[index].name();  };
00078 
00080   int indexByName( std::string name );
00081 
00083   virtual bool globalTiming() { return m_globalTiming; };
00084 
00085 protected:
00086 
00087 private:
00088   int m_shots;       
00089   bool m_normalised; 
00090   int m_indent;      
00091   std::vector<TimerForSequencer> m_timerList;
00092   double m_normFactor; 
00093   double m_speedRatio;
00094   bool   m_globalTiming;
00095   std::string::size_type m_headerSize;   
00096 };
00097 #endif // SEQUENCERTIMERTOOL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:24:48 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004