CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
evf::FastMonitoringService Class Reference

#include <FastMonitoringService.h>

Inheritance diagram for evf::FastMonitoringService:
evf::MicroStateService

Classes

struct  Encoding
 

Public Member Functions

void accummulateFileSize (unsigned long fileSize)
 
 FastMonitoringService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
unsigned int getEventsProcessedForLumi (unsigned int lumi)
 
std::string getOutputDefPath () const
 
std::string getRunDirName () const
 
void jobFailure ()
 
std::string makeModuleLegenda ()
 
std::string makePathLegenda ()
 
void postBeginJob ()
 
void postBeginRun (edm::Run const &, edm::EventSetup const &)
 
void postEndJob ()
 
void postEventProcessing (const edm::Event &, const edm::EventSetup &)
 
void postModule (const edm::ModuleDescription &)
 
void postSourceEvent (edm::StreamID)
 
void preBeginLumi (edm::LuminosityBlockID const &iID, edm::Timestamp const &iTime)
 
void preEndLumi (edm::LuminosityBlockID const &iID, edm::Timestamp const &iTime)
 
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
 
void preModule (const edm::ModuleDescription &)
 
void preModuleBeginJob (const edm::ModuleDescription &desc)
 
void prePathBeginRun (const std::string &pathName)
 
void preProcessPath (const std::string &pathName)
 
void preSourceEvent (edm::StreamID)
 
void setMicroState (Microstate)
 
void startedLookingForFile ()
 
void stoppedLookingForFile ()
 
 ~FastMonitoringService ()
 
- Public Member Functions inherited from evf::MicroStateService
virtual std::string getMicroState1 ()
 
virtual std::string const & getMicroState2 ()
 
 MicroStateService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
virtual ~MicroStateService ()
 

Static Public Attributes

static const std::string macroStateNames [FastMonitoringThread::MCOUNT]
 
static const std::string nopath_ = "NoPath"
 
- Static Public Attributes inherited from evf::MicroStateService
static const edm::ModuleDescription reservedMicroStateNames [mCOUNT]
 

Private Member Functions

void dowork ()
 

Private Attributes

Encoding encModule_
 
Encoding encPath_
 
string fastName_
 
string fastPath_
 
timeval fileLookStart_
 
timeval fileLookStop_
 
FastMonitoringThread fmt_
 
std::vector< double > leadTimes_
 
timeval lumiStartTime_
 
timeval lumiStopTime_
 
string microstateDefPath_
 
string outputDefPath_
 
std::unordered_map< unsigned
int, int > 
processedEventsPerLumi_
 
boost::filesystem::path runDirectory_
 
int sleepTime_
 
string slowName_
 
boost::filesystem::path workingDirectory_
 

Additional Inherited Members

- Public Types inherited from evf::MicroStateService
enum  Microstate {
  mInvalid = 0, mFwkOvh, mIdle, mInput,
  mInputDone, mDqm, mCOUNT
}
 
- Protected Attributes inherited from evf::MicroStateService
boost::mutex lock_
 
- Static Protected Attributes inherited from evf::MicroStateService
static const std::string default_return_ ="NotImplemented"
 

Detailed Description

Definition at line 49 of file FastMonitoringService.h.

Constructor & Destructor Documentation

evf::FastMonitoringService::FastMonitoringService ( const edm::ParameterSet iPS,
edm::ActivityRegistry reg 
)

Definition at line 19 of file FastMonitoringService.cc.

References evf::FastMonitoringThread::MonitorData::accuSize_, evf::FastMonitoringThread::MonitorData::avgLeadTimeJ_, evf::FastMonitoringService::Encoding::completeReservedWithDummies(), gather_cfg::cout, evf::FastMonitoringService::Encoding::current_, dowork(), encModule_, encPath_, fastName_, fastPath_, evf::FastMonitoringThread::MonitorData::filesProcessedDuringLumi_, fmt_, i, jobFailure(), evf::FastMonitoringThread::MonitorData::jsonMonitor_, evf::FastMonitoringThread::MonitorData::lumisection_, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::MonitorData::macrostate_, evf::FastMonitoringThread::MonitorData::macrostateJ_, evf::FastMonitoringThread::MCOUNT, evf::MicroStateService::mCOUNT, evf::FastMonitoringThread::MonitorData::microstate_, microstateDefPath_, evf::FastMonitoringThread::MonitorData::microstateJ_, evf::FastMonitoringThread::MonitorData::ministate_, evf::FastMonitoringThread::MonitorData::ministateJ_, evf::MicroStateService::mInvalid, nopath_, getHLTPrescaleColumns::path, postBeginJob(), postBeginRun(), postEndJob(), postEventProcessing(), postModule(), postSourceEvent(), preBeginLumi(), preEndLumi(), preEventProcessing(), preModule(), preModuleBeginJob(), prePathBeginRun(), preProcessPath(), preSourceEvent(), evf::FastMonitoringThread::MonitorData::processedJ_, evf::MicroStateService::reservedMicroStateNames, runDirectory_, jsoncollector::JsonMonitorable::setName(), evf::FastMonitoringThread::sInit, evf::FastMonitoringThread::start(), evf::FastMonitoringThread::MonitorData::throughputJ_, evf::FastMonitoringService::Encoding::update(), evf::FastMonitoringService::Encoding::updateReserved(), edm::ActivityRegistry::watchJobFailure(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostBeginRun(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPostSourceEvent(), edm::ActivityRegistry::watchPreBeginLumi(), edm::ActivityRegistry::watchPreEndLumi(), edm::ActivityRegistry::watchPreModule(), edm::ActivityRegistry::watchPreModuleBeginJob(), edm::ActivityRegistry::watchPrePathBeginRun(), edm::ActivityRegistry::watchPreProcessEvent(), edm::ActivityRegistry::watchPreProcessPath(), edm::ActivityRegistry::watchPreSourceEvent(), and workingDirectory_.

20  :
21  MicroStateService(iPS,reg)
22  ,encModule_(33)
23  ,encPath_(0)
24  ,sleepTime_(iPS.getUntrackedParameter<int>("sleepTime", 1))
25  //,rootDirectory_(iPS.getUntrackedParameter<string>("rootDirectory", "/data"))
26  ,microstateDefPath_(iPS.getUntrackedParameter<string>("microstateDefPath", "/tmp/def.jsd"))
27  ,outputDefPath_(iPS.getUntrackedParameter<string>("outputDefPath", "/tmp/def.jsd"))
28  ,fastName_(iPS.getUntrackedParameter<string>("fastName", "states"))
29  ,slowName_(iPS.getUntrackedParameter<string>("slowName", "lumi"))
30  {
35  fmt_.m_data.accuSize_ = 0;
49 
53  for(unsigned int i = 0; i < (mCOUNT); i++)
55  encPath_.update((void*)&nopath_);
57 
58  fmt_.m_data.macrostateJ_.setName("Macrostate");
59  fmt_.m_data.ministateJ_.setName("Ministate");
60  fmt_.m_data.microstateJ_.setName("Microstate");
61  fmt_.m_data.processedJ_.setName("Processed");
62  fmt_.m_data.throughputJ_.setName("Throughput");
63  fmt_.m_data.avgLeadTimeJ_.setName("AverageLeadTime");
64  fmt_.m_data.filesProcessedDuringLumi_.setName("FilesProcessed");
65  vector<JsonMonitorable*> monParams;
66  monParams.push_back(&fmt_.m_data.macrostateJ_);
67  monParams.push_back(&fmt_.m_data.ministateJ_);
68  monParams.push_back(&fmt_.m_data.microstateJ_);
69  monParams.push_back(&fmt_.m_data.processedJ_);
70  monParams.push_back(&fmt_.m_data.throughputJ_);
71  monParams.push_back(&fmt_.m_data.avgLeadTimeJ_);
72  monParams.push_back(&fmt_.m_data.filesProcessedDuringLumi_);
73 
74  // The run dir should be set via the configuration
75  // For now, just grab the latest run directory available
76 
77  // FIND RUN DIRECTORY
78  boost::filesystem::path runDirectory(edm::Service<evf::EvFDaqDirector>()->findHighestRunDir());
79  workingDirectory_ = runDirectory_ = runDirectory;
80  workingDirectory_ /= "mon";
81 
82  bool foundMonDir = false;
83  if ( boost::filesystem::is_directory(workingDirectory_))
84  foundMonDir=true;
85  if (!foundMonDir) {
86  std::cout << "<MON> DIR NOT FOUND!" << std::endl;
87  boost::filesystem::create_directories(workingDirectory_);
88  }
89 
90  std::ostringstream fastFileName;
91 
92  fastFileName << fastName_ << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".fast";
94  fast /= fastFileName.str();
95  fastPath_ = fast.string();
96 
97  /*
98  * initialize the fast monitor with:
99  * vector of pointers to monitorable parameters
100  * path to definition
101  *
102  */
103  std::cout
104  << "FastMonitoringService: initializing FastMonitor with microstate def path: "
106  << encPath_.current_ + 1 << " " << encModule_.current_ + 1
107  << std::endl;
108 
109  fmt_.m_data.jsonMonitor_.reset(
110  new FastMonitor(monParams, microstateDefPath_));
111 
113  }
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
void preBeginLumi(edm::LuminosityBlockID const &iID, edm::Timestamp const &iTime)
boost::filesystem::path runDirectory_
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void start(void(FastMonitoringService::*fp)(), FastMonitoringService *cp)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
void watchPreEndLumi(PreEndLumi::slot_type const &iSlot)
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
void watchPreModule(PreModule::slot_type const &iSlot)
void prePathBeginRun(const std::string &pathName)
void watchJobFailure(JobFailure::slot_type const &iSlot)
convenience function for attaching to signal
void preEndLumi(edm::LuminosityBlockID const &iID, edm::Timestamp const &iTime)
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
MicroStateService(const edm::ParameterSet &, edm::ActivityRegistry &)
void watchPrePathBeginRun(PrePathBeginRun::slot_type const &iSlot)
boost::shared_ptr< FastMonitor > jsonMonitor_
static const std::string nopath_
void postBeginRun(edm::Run const &, edm::EventSetup const &)
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void preProcessPath(const std::string &pathName)
void preModule(const edm::ModuleDescription &)
void postModule(const edm::ModuleDescription &)
void preModuleBeginJob(const edm::ModuleDescription &desc)
boost::filesystem::path workingDirectory_
void watchPreBeginLumi(PreBeginLumi::slot_type const &iSlot)
tuple cout
Definition: gather_cfg.py:121
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void postEventProcessing(const edm::Event &, const edm::EventSetup &)
void watchPreProcessPath(PreProcessPath::slot_type const &iSlot)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
evf::FastMonitoringService::~FastMonitoringService ( )

Definition at line 116 of file FastMonitoringService.cc.

117  {
118  }

Member Function Documentation

void evf::FastMonitoringService::accummulateFileSize ( unsigned long  fileSize)
void evf::FastMonitoringService::dowork ( )
inlineprivate

Definition at line 138 of file FastMonitoringService.h.

References gather_cfg::cout, encModule_, evf::FastMonitoringService::Encoding::encode(), encPath_, fastPath_, fmt_, evf::FastMonitoringThread::MonitorData::jsonMonitor_, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::m_stoprequest, evf::FastMonitoringThread::MonitorData::macrostate_, evf::FastMonitoringThread::MonitorData::macrostateJ_, evf::FastMonitoringThread::MonitorData::microstate_, evf::FastMonitoringThread::MonitorData::microstateJ_, evf::FastMonitoringThread::MonitorData::ministate_, evf::FastMonitoringThread::MonitorData::ministateJ_, evf::FastMonitoringThread::monlock_, and sleepTime_.

Referenced by FastMonitoringService().

138  { // the function to be called in the thread. Thread completes when function returns.
139  while (!fmt_.m_stoprequest) {
140  std::cout << "Current states: Ms=" << fmt_.m_data.macrostate_
141  << " ms=" << encPath_.encode(fmt_.m_data.ministate_)
142  << " us=" << encModule_.encode(fmt_.m_data.microstate_)
143  << std::endl;
144 
145  // lock the monitor
146  fmt_.monlock_.lock();
151 
152  fmt_.m_data.jsonMonitor_->snap(true, fastPath_);
153  fmt_.monlock_.unlock();
154 
155  //::sleep(1);
156  ::sleep(sleepTime_);
157  }
158  }
boost::shared_ptr< FastMonitor > jsonMonitor_
tuple cout
Definition: gather_cfg.py:121
unsigned int evf::FastMonitoringService::getEventsProcessedForLumi ( unsigned int  lumi)

Definition at line 320 of file FastMonitoringService.cc.

References fjr2json::lumi.

320  {
322 }
tuple lumi
Definition: fjr2json.py:35
std::unordered_map< unsigned int, int > processedEventsPerLumi_
std::string evf::FastMonitoringService::getOutputDefPath ( ) const
inline
std::string evf::FastMonitoringService::getRunDirName ( ) const
inline

Definition at line 135 of file FastMonitoringService.h.

References runDirectory_.

135 { return runDirectory_.stem().string(); }
boost::filesystem::path runDirectory_
void evf::FastMonitoringService::jobFailure ( )
std::string evf::FastMonitoringService::makeModuleLegenda ( )

Definition at line 162 of file FastMonitoringService.cc.

References evf::FastMonitoringService::Encoding::current_, evf::FastMonitoringService::Encoding::decode(), encModule_, and i.

Referenced by postBeginJob().

162  {
163 
164  std::ostringstream ost;
165  for(int i = 0;
167  i++)
168  {
169  // std::cout << "for i = " << i << std::endl;
170  ost<<i<<"="<<((const edm::ModuleDescription *)(encModule_.decode(i)))->moduleLabel()<<" ";
171  }
172  return ost.str();
173  }
int i
Definition: DBlmapReader.cc:9
const void * decode(unsigned int index)
std::string evf::FastMonitoringService::makePathLegenda ( )

Definition at line 152 of file FastMonitoringService.cc.

References evf::FastMonitoringService::Encoding::current_, evf::FastMonitoringService::Encoding::decode(), encPath_, i, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by postBeginJob(), and postBeginRun().

152  {
153 
154  std::ostringstream ost;
155  for(int i = 0;
156  i < encPath_.current_;
157  i++)
158  ost<<i<<"="<<*((std::string *)(encPath_.decode(i)))<<" ";
159  return ost.str();
160  }
int i
Definition: DBlmapReader.cc:9
const void * decode(unsigned int index)
void evf::FastMonitoringService::postBeginJob ( )

Definition at line 175 of file FastMonitoringService.cc.

References gather_cfg::cout, fmt_, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::MonitorData::macrostate_, makeModuleLegenda(), makePathLegenda(), and evf::FastMonitoringThread::sJobReady.

Referenced by FastMonitoringService().

176  {
177  // boost::mutex::scoped_lock sl(lock_);
178  std::cout << "path legenda*****************" << std::endl;
179  std::cout << makePathLegenda() << std::endl;
180  std::cout << "module legenda***************" << std::endl;
181  std::cout << makeModuleLegenda() << std::endl;
183  }
tuple cout
Definition: gather_cfg.py:121
void evf::FastMonitoringService::postBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
void evf::FastMonitoringService::postEndJob ( )
void evf::FastMonitoringService::postEventProcessing ( const edm::Event e,
const edm::EventSetup  
)
void evf::FastMonitoringService::postModule ( const edm::ModuleDescription desc)

Definition at line 268 of file FastMonitoringService.cc.

References fmt_, evf::FastMonitoringThread::m_data, and evf::FastMonitoringThread::MonitorData::microstate_.

Referenced by FastMonitoringService().

269  {
270  // boost::mutex::scoped_lock sl(lock_);
271  fmt_.m_data.microstate_ = &desc;
272  }
void evf::FastMonitoringService::postSourceEvent ( edm::StreamID  )
void evf::FastMonitoringService::preBeginLumi ( edm::LuminosityBlockID const &  iID,
edm::Timestamp const &  iTime 
)

Definition at line 192 of file FastMonitoringService.cc.

References gather_cfg::cout, fmt_, edm::LuminosityBlockID::luminosityBlock(), evf::FastMonitoringThread::MonitorData::lumisection_, lumiStartTime_, evf::FastMonitoringThread::m_data, and evf::FastMonitoringThread::monlock_.

Referenced by FastMonitoringService().

193  {
194  std::cout << "FastMonitoringService: Pre-begin LUMI: " << iID.luminosityBlock() << std::endl;
195  fmt_.monlock_.lock();
196  fmt_.m_data.lumisection_ = (unsigned int) iID.luminosityBlock();
197  gettimeofday(&lumiStartTime_, 0);
198  fmt_.monlock_.unlock();
199  }
tuple cout
Definition: gather_cfg.py:121
void evf::FastMonitoringService::preEndLumi ( edm::LuminosityBlockID const &  iID,
edm::Timestamp const &  iTime 
)

Definition at line 201 of file FastMonitoringService.cc.

References evf::FastMonitoringThread::MonitorData::accuSize_, evf::FastMonitoringThread::MonitorData::avgLeadTimeJ_, gather_cfg::cout, fastPath_, evf::FastMonitoringThread::MonitorData::filesProcessedDuringLumi_, fmt_, evf::FastMonitoringThread::MonitorData::jsonMonitor_, leadTimes_, edm::LuminosityBlockID::luminosityBlock(), evf::FastMonitoringThread::MonitorData::lumisection_, lumiStartTime_, lumiStopTime_, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::monlock_, getHLTPrescaleColumns::path, processedEventsPerLumi_, evf::FastMonitoringThread::MonitorData::processedJ_, slowName_, evf::FastMonitoringThread::MonitorData::throughputJ_, jsoncollector::IntJ::value(), jsoncollector::DoubleJ::value(), and workingDirectory_.

Referenced by FastMonitoringService().

202  {
203  std::cout << "FastMonitoringService: LUMI: " << iID.luminosityBlock() << " ended! Writing JSON information..." << std::endl;
204  fmt_.monlock_.lock();
205  gettimeofday(&lumiStopTime_, 0);
206 
207  // Compute throughput
208  unsigned int secondsForLumi = lumiStopTime_.tv_sec - lumiStartTime_.tv_sec;
209  fmt_.m_data.throughputJ_.value() = double(fmt_.m_data.accuSize_) / double(secondsForLumi) / double(1024*1024);
210 
211  std::cout
212  << ">>> >>> FastMonitoringService: processed event count for this lumi = "
213  << fmt_.m_data.processedJ_.value() << " time = " << secondsForLumi
214  << " size = " << fmt_.m_data.accuSize_ << " thr = " << fmt_.m_data.throughputJ_.value() << std::endl;
215  fmt_.m_data.jsonMonitor_->snap(true, fastPath_);
216  // create file name for slow monitoring file
217  std::stringstream slowFileName;
218  slowFileName << slowName_ << "_ls" << std::setfill('0') << std::setw(4)
219  << fmt_.m_data.lumisection_ << "_pid" << std::setfill('0')
220  << std::setw(5) << getpid() << ".jsn";
222  slow /= slowFileName.str();
223  fmt_.m_data.jsonMonitor_->outputFullHistoDataPoint(slow.string());
225 
226  fmt_.m_data.processedJ_ = 0;
227  fmt_.m_data.accuSize_ = 0;
231  leadTimes_.clear();
232  fmt_.monlock_.unlock();
233  }
std::unordered_map< unsigned int, int > processedEventsPerLumi_
boost::shared_ptr< FastMonitor > jsonMonitor_
std::vector< double > leadTimes_
boost::filesystem::path workingDirectory_
tuple cout
Definition: gather_cfg.py:121
void evf::FastMonitoringService::preEventProcessing ( const edm::EventID iID,
const edm::Timestamp iTime 
)

Definition at line 235 of file FastMonitoringService.cc.

Referenced by FastMonitoringService().

237  {
238  // boost::mutex::scoped_lock sl(lock_);
239  }
void evf::FastMonitoringService::preModule ( const edm::ModuleDescription desc)

Definition at line 262 of file FastMonitoringService.cc.

References fmt_, evf::FastMonitoringThread::m_data, and evf::FastMonitoringThread::MonitorData::microstate_.

Referenced by FastMonitoringService().

263  {
264  // boost::mutex::scoped_lock sl(lock_);
265  fmt_.m_data.microstate_ = &desc;
266  }
void evf::FastMonitoringService::preModuleBeginJob ( const edm::ModuleDescription desc)

Definition at line 120 of file FastMonitoringService.cc.

References encModule_, edm::ModuleDescription::moduleName(), evf::FastMonitoringService::Encoding::update(), and evf::FastMonitoringService::Encoding::updateReserved().

Referenced by FastMonitoringService().

121  {
122  //build a map of modules keyed by their module description address
123  //here we need to treat output modules in a special way so they can be easily singled out
124  if(desc.moduleName() == "ShmStreamConsumer" || desc.moduleName() == "EventStreamFileWriter" ||
125  desc.moduleName() == "PoolOutputModule")
126  encModule_.updateReserved((void*)&desc);
127  else
128  encModule_.update((void*)&desc);
129  }
std::string const & moduleName() const
void evf::FastMonitoringService::prePathBeginRun ( const std::string &  pathName)

Definition at line 131 of file FastMonitoringService.cc.

References gather_cfg::cout, encPath_, and evf::FastMonitoringService::Encoding::update().

Referenced by FastMonitoringService().

132  {
133  //bonus track, now monitoring path execution too...
134  // here we are forced to use string keys...
135  std::cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>update path map with " << pathName << std::endl;
136  encPath_.update((void*)&pathName);
137  }
tuple cout
Definition: gather_cfg.py:121
void evf::FastMonitoringService::preProcessPath ( const std::string &  pathName)
void evf::FastMonitoringService::preSourceEvent ( edm::StreamID  )
void evf::FastMonitoringService::setMicroState ( Microstate  m)
virtual

Implements evf::MicroStateService.

Definition at line 278 of file FastMonitoringService.cc.

References fmt_, m, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::MonitorData::microstate_, and evf::MicroStateService::reservedMicroStateNames.

279  {
280  // boost::mutex::scoped_lock sl(lock_);
282  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
void evf::FastMonitoringService::startedLookingForFile ( )

Definition at line 292 of file FastMonitoringService.cc.

References fileLookStart_.

Referenced by FedRawDataInputSource::searchForNextFile().

292  {
293  gettimeofday(&fileLookStart_, 0);
294  /*
295  std::cout << "Started looking for .raw file at: s=" << fileLookStart_.tv_sec << ": ms = "
296  << fileLookStart_.tv_usec / 1000.0 << std::endl;
297  */
298  }
void evf::FastMonitoringService::stoppedLookingForFile ( )

Definition at line 300 of file FastMonitoringService.cc.

References evf::FastMonitoringThread::MonitorData::avgLeadTimeJ_, fileLookStart_, fileLookStop_, fmt_, i, leadTimes_, and evf::FastMonitoringThread::m_data.

Referenced by FedRawDataInputSource::searchForNextFile().

300  {
301  gettimeofday(&fileLookStop_, 0);
302  /*
303  std::cout << "Stopped looking for .raw file at: s=" << fileLookStop_.tv_sec << ": ms = "
304  << fileLookStop_.tv_usec / 1000.0 << std::endl;
305  */
306  double elapsedTime = (fileLookStop_.tv_sec - fileLookStart_.tv_sec) * 1000.0; // sec to ms
307  elapsedTime += (fileLookStop_.tv_usec - fileLookStart_.tv_usec) / 1000.0; // us to ms
308  // add this to lead times for this lumi
309  leadTimes_.push_back(elapsedTime);
310 
311  // recompute average lead time for this lumi
312  if (leadTimes_.size() == 1) fmt_.m_data.avgLeadTimeJ_ = leadTimes_[0];
313  else {
314  double totTime = 0;
315  for (unsigned int i = 0; i < leadTimes_.size(); i++) totTime += leadTimes_[i];
316  fmt_.m_data.avgLeadTimeJ_ = totTime / leadTimes_.size();
317  }
318  }
int i
Definition: DBlmapReader.cc:9
std::vector< double > leadTimes_

Member Data Documentation

Encoding evf::FastMonitoringService::encModule_
private
Encoding evf::FastMonitoringService::encPath_
private
string evf::FastMonitoringService::fastName_
private

Definition at line 167 of file FastMonitoringService.h.

Referenced by FastMonitoringService().

string evf::FastMonitoringService::fastPath_
private

Definition at line 167 of file FastMonitoringService.h.

Referenced by dowork(), FastMonitoringService(), and preEndLumi().

timeval evf::FastMonitoringService::fileLookStart_
private

Definition at line 169 of file FastMonitoringService.h.

Referenced by startedLookingForFile(), and stoppedLookingForFile().

timeval evf::FastMonitoringService::fileLookStop_
private

Definition at line 169 of file FastMonitoringService.h.

Referenced by stoppedLookingForFile().

FastMonitoringThread evf::FastMonitoringService::fmt_
private
std::vector<double> evf::FastMonitoringService::leadTimes_
private

Definition at line 170 of file FastMonitoringService.h.

Referenced by preEndLumi(), and stoppedLookingForFile().

timeval evf::FastMonitoringService::lumiStartTime_
private

Definition at line 168 of file FastMonitoringService.h.

Referenced by preBeginLumi(), and preEndLumi().

timeval evf::FastMonitoringService::lumiStopTime_
private

Definition at line 168 of file FastMonitoringService.h.

Referenced by preEndLumi().

const std::string evf::FastMonitoringService::macroStateNames
static
Initial value:
=
{"Init","JobReady","RunGiven","Running",
"Stopping","Done","JobEnded","Error","ErrorEnded","End",
"Invalid"}

Definition at line 98 of file FastMonitoringService.h.

string evf::FastMonitoringService::microstateDefPath_
private

Definition at line 166 of file FastMonitoringService.h.

Referenced by FastMonitoringService().

const std::string evf::FastMonitoringService::nopath_ = "NoPath"
static

Definition at line 101 of file FastMonitoringService.h.

Referenced by FastMonitoringService().

string evf::FastMonitoringService::outputDefPath_
private

Definition at line 166 of file FastMonitoringService.h.

Referenced by getOutputDefPath().

std::unordered_map<unsigned int, int> evf::FastMonitoringService::processedEventsPerLumi_
private

Definition at line 171 of file FastMonitoringService.h.

Referenced by preEndLumi().

boost::filesystem::path evf::FastMonitoringService::runDirectory_
private

Definition at line 172 of file FastMonitoringService.h.

Referenced by FastMonitoringService(), and getRunDirName().

int evf::FastMonitoringService::sleepTime_
private

Definition at line 165 of file FastMonitoringService.h.

Referenced by dowork().

string evf::FastMonitoringService::slowName_
private

Definition at line 167 of file FastMonitoringService.h.

Referenced by preEndLumi().

boost::filesystem::path evf::FastMonitoringService::workingDirectory_
private

Definition at line 172 of file FastMonitoringService.h.

Referenced by FastMonitoringService(), and preEndLumi().