CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pos::PixelTimeFormatter Class Reference

#include <PixelTimeFormatter.h>

Public Member Functions

struct timeval getImSecTime (void)
 
struct tm * getITime (void)
 
 PixelTimeFormatter (std::string source)
 
void stopTimer (void)
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const
 
virtual ~PixelTimeFormatter ()=default
 

Static Public Member Functions

static std::string getmSecTime (void)
 
static std::string getTime (void)
 

Private Attributes

struct timeval endTime_
 
std::string origin_
 
struct timeval startTime_
 
bool verbose_
 

Detailed Description

Definition at line 27 of file PixelTimeFormatter.h.

Constructor & Destructor Documentation

pos::PixelTimeFormatter::PixelTimeFormatter ( std::string  source)
inline

Definition at line 32 of file PixelTimeFormatter.h.

References gather_cfg::cout, getImSecTime(), origin_, mathSSE::return(), source, startTime_, USE_TIMER_, and ~PixelTimeFormatter().

33  {
34  if( !USE_TIMER_) return ;
35  origin_ = source ;
36  std::cout << "[PixelTimeFormatter::PixelTimeFormatter()]\t\t Time counter started for " << origin_ << std::endl ;
38  }
struct timeval getImSecTime(void)
return((rh^lh)&mask)
#define USE_TIMER_
static std::string const source
Definition: EdmProvDump.cc:44
virtual pos::PixelTimeFormatter::~PixelTimeFormatter ( )
virtualdefault

Referenced by PixelTimeFormatter().

Member Function Documentation

struct timeval pos::PixelTimeFormatter::getImSecTime ( void  )
inline

Definition at line 109 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

110  {
111  struct timeval msecTime;
112  gettimeofday(&msecTime, (struct timezone *)nullptr) ;
113 
114  return msecTime ;
115  }
struct tm* pos::PixelTimeFormatter::getITime ( void  )
inline

Definition at line 83 of file PixelTimeFormatter.h.

References ntuplemaker::time.

84  {
85  struct tm *thisTime;
86  time_t aclock;
87  time( &aclock );
88  thisTime = localtime( &aclock );
89  return thisTime ;
90  }
static std::string pos::PixelTimeFormatter::getmSecTime ( void  )
inlinestatic
static std::string pos::PixelTimeFormatter::getTime ( void  )
inlinestatic

Definition at line 59 of file PixelTimeFormatter.h.

References constexpr, indexGen::date, AlCaHLTBitMon_QueryRunRegistry::string, and ntuplemaker::time.

Referenced by pos::PixelFEDCard::writeXML(), pos::PixelDetectorConfig::writeXML(), pos::PixelNameTranslation::writeXML(), pos::PixelTTCciConfig::writeXMLHeader(), pos::PixelDelay25Calib::writeXMLHeader(), pos::PixelMaxVsf::writeXMLHeader(), pos::PixelPortCardConfig::writeXMLHeader(), pos::PixelMaskAllPixels::writeXMLHeader(), pos::PixelLowVoltageMap::writeXMLHeader(), pos::PixelLTCConfig::writeXMLHeader(), pos::PixelGlobalDelay25::writeXMLHeader(), pos::PixelFECConfig::writeXMLHeader(), pos::PixelTBMSettings::writeXMLHeader(), pos::PixelTrimAllPixels::writeXMLHeader(), pos::PixelFEDConfig::writeXMLHeader(), pos::PixelTKFECConfig::writeXMLHeader(), pos::PixelFEDCard::writeXMLHeader(), pos::PixelDetectorConfig::writeXMLHeader(), pos::PixelPortcardMap::writeXMLHeader(), pos::PixelDACSettings::writeXMLHeader(), pos::PixelNameTranslation::writeXMLHeader(), and pos::PixelCalibConfiguration::writeXMLHeader().

60  {
61  constexpr size_t kBufferLength = 72;
62  char theDate[kBufferLength] ;
63  struct tm *thisTime;
64  time_t aclock;
66  time( &aclock );
67  thisTime = localtime( &aclock );
68 
69  snprintf(theDate,
70  kBufferLength,
71  "%d-%02d-%02d %02d:%02d:%02d", thisTime->tm_year+1900,
72  thisTime->tm_mon+1,
73  thisTime->tm_mday,
74  thisTime->tm_hour,
75  thisTime->tm_min,
76  thisTime->tm_sec );
77  date = theDate ;
78  //std::cout << "[PixelTimeFormatter::getTime()]\t\t\t\t Time: " << date << std::endl ;
79  return date ;
80  }
#define constexpr
void pos::PixelTimeFormatter::stopTimer ( void  )
inline

Definition at line 42 of file PixelTimeFormatter.h.

References gather_cfg::cout, endTime_, getImSecTime(), origin_, mathSSE::return(), startTime_, and USE_TIMER_.

43  {
44  if( !USE_TIMER_ ) return ;
46  double start = startTime_.tv_sec + startTime_.tv_usec/1000000. ;
47  double stop = endTime_.tv_sec + endTime_.tv_usec/1000000. ;
48  std::cout << "[PixelTimeFormatter::stopTimer()]\t\t\t Elapsed time: " << stop-start << " seconds for " << origin_ << std::endl ;
49  }
Definition: start.py:1
struct timeval getImSecTime(void)
return((rh^lh)&mask)
#define USE_TIMER_
virtual void pos::PixelTimeFormatter::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
inlinevirtual

Definition at line 51 of file PixelTimeFormatter.h.

56  {;}

Member Data Documentation

struct timeval pos::PixelTimeFormatter::endTime_
private

Definition at line 153 of file PixelTimeFormatter.h.

Referenced by stopTimer().

std::string pos::PixelTimeFormatter::origin_
private

Definition at line 154 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

struct timeval pos::PixelTimeFormatter::startTime_
private

Definition at line 152 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

bool pos::PixelTimeFormatter::verbose_
private

Definition at line 155 of file PixelTimeFormatter.h.