CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastMonitoringService.cc
Go to the documentation of this file.
2 #include <iostream>
3 
5 #include <iomanip>
6 #include <sys/time.h>
7 
17 
20 
21 constexpr double throughputFactor() {return (1000000)/double(1024*1024);}
22 
23 namespace evf{
24 
26  {"Init","JobReady","RunGiven","Running",
27  "Stopping","Done","JobEnded","Error","ErrorEnded","End",
28  "Invalid"};
29 
31 
33  edm::ActivityRegistry& reg) :
34  MicroStateService(iPS,reg)
35  ,encModule_(33)
36  ,nStreams_(0)//until initialized
37  ,sleepTime_(iPS.getUntrackedParameter<int>("sleepTime", 1))
38  ,fastMonIntervals_(iPS.getUntrackedParameter<unsigned int>("fastMonIntervals", 1))
39  ,microstateDefPath_(iPS.getUntrackedParameter<std::string> ("microstateDefPath", std::string(getenv("CMSSW_BASE"))+"/src/EventFilter/Utilities/plugins/microstatedef.jsd"))
40  ,fastMicrostateDefPath_(iPS.getUntrackedParameter<std::string>("fastMicrostateDefPath", microstateDefPath_))
41  ,fastName_(iPS.getUntrackedParameter<std::string>("fastName", "fastmoni"))
42  ,slowName_(iPS.getUntrackedParameter<std::string>("slowName", "slowmoni"))
43  ,totalEventsProcessed_(0)
44  {
45  reg.watchPreallocate(this, &FastMonitoringService::preallocate);//receiving information on number of threads
47 
51 
55 
60 
62 
65 
66  reg.watchPreSourceEvent(this,&FastMonitoringService::preSourceEvent);//source (with streamID of requestor)
68 
71 
75  }
76 
77 
79  {
80  }
81 
82 
84  //taken from first stream
85  std::ostringstream ost;
86  for(int i = 0;
87  i < encPath_[0].current_;
88  i++)
89  ost<<i<<"="<<*((std::string *)(encPath_[0].decode(i)))<<" ";
90  return ost.str();
91  }
92 
93 
95  {
96  std::ostringstream ost;
97  for(int i = 0; i < encModule_.current_; i++)
98  ost<<i<<"="<<((const edm::ModuleDescription *)(encModule_.decode(i)))->moduleLabel()<<" ";
99  return ost.str();
100  }
101 
102 
104  {
105 
106  // FIND RUN DIRECTORY
107  // The run dir should be set via the configuration of EvFDaqDirector
108 
109  if (edm::Service<evf::EvFDaqDirector>().operator->()==nullptr)
110  {
111  throw cms::Exception("FastMonitoringService") << "EvFDaqDirector is not present";
112 
113  }
114  boost::filesystem::path runDirectory(edm::Service<evf::EvFDaqDirector>()->baseRunDir());
115  workingDirectory_ = runDirectory_ = runDirectory;
116  workingDirectory_ /= "mon";
117 
118  if ( !boost::filesystem::is_directory(workingDirectory_)) {
119  LogDebug("FastMonitoringService") << "<MON> DIR NOT FOUND! Trying to create -: " << workingDirectory_.string() ;
120  boost::filesystem::create_directories(workingDirectory_);
121  if ( !boost::filesystem::is_directory(workingDirectory_))
122  edm::LogWarning("FastMonitoringService") << "Unable to create <MON> DIR -: " << workingDirectory_.string()
123  << ". No monitoring data will be written.";
124  }
125 
126  std::ostringstream fastFileName;
127 
128  fastFileName << fastName_ << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".fast";
130  fast /= fastFileName.str();
131  fastPath_ = fast.string();
132 
133  std::ostringstream moduleLegFile;
134  moduleLegFile << "microstatelegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
135  moduleLegendFile_ = (workingDirectory_/moduleLegFile.str()).string();
136 
137  std::ostringstream pathLegFile;
138  pathLegFile << "pathlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
139  pathLegendFile_ = (workingDirectory_/pathLegFile.str()).string();
140 
141  LogDebug("FastMonitoringService") << "Initializing FastMonitor with microstate def path -: "
143  //<< encPath_.current_ + 1 << " " << encModule_.current_ + 1
144 
145  nStreams_=bounds.maxNumberOfStreams();
146  nThreads_=bounds.maxNumberOfThreads();
147 
148  //this should already be >=1
149  if (nStreams_==0) nStreams_=1;
150  if (nThreads_==0) nThreads_=1;
151 
152  /*
153  * initialize the fast monitor with:
154  * vector of pointers to monitorable parameters
155  * path to definition
156  *
157  */
158 
160 
161  for(unsigned int i = 0; i < (mCOUNT); i++)
164 
165  for (unsigned int i=0;i<nStreams_;i++) {
166  ministate_.push_back(&nopath_);
168 
169  //for synchronization
170  streamCounterUpdating_.push_back(new std::atomic<bool>(0));
171 
172  //path (mini) state
173  encPath_.emplace_back(0);
174  encPath_[i].update((void*)&nopath_);
175  eventCountForPathInit_.push_back(0);
176  firstEventId_.push_back(0);
177  collectedPathList_.push_back(new std::atomic<bool>(0));
178 
179  }
180  //for (unsigned int i=0;i<nThreads_;i++)
181  // threadMicrostate_.push_back(&reservedMicroStateNames[mInvalid]);
182 
183  //initial size until we detect number of bins
187 
188  lastGlobalLumi_=0;
190  lumiFromSource_=0;
191 
192  //startup monitoring
194  fmt_.jsonMonitor_->setNStreams(nStreams_);
196  monInit_.store(false,std::memory_order_release);
198 
199  //this definition needs: #include "tbb/compat/thread"
200  //however this would results in TBB imeplementation replacing std::thread
201  //(both supposedly call pthread_self())
202  //number of threads created in process could be obtained from /proc,
203  //assuming that all posix threads are true kernel threads capable of running in parallel
204 
205  //#if TBB_IMPLEMENT_CPP0X
207  //threadIDAvailable_=true;
208  //#endif
209 
210  }
211 
213  {
214  std::string context;
215  if (to==edm::TerminationOrigin::ExceptionFromThisContext) context = " FromThisContext ";
216  if (to==edm::TerminationOrigin::ExceptionFromAnotherContext) context = " FromAnotherContext";
217  if (to==edm::TerminationOrigin::ExternalSignal) context = " FromExternalSignal";
218  edm::LogInfo("FastMonitoringService") << " STREAM " << sc.streamID().value() << " earlyTermination -: ID:"<< sc.eventID()
219  << " LS:" << sc.eventID().luminosityBlock() << " " << context;
220  std::lock_guard<std::mutex> lock(fmt_.monlock_);
221  exceptionInLS_.push_back(sc.eventID().luminosityBlock());
222  //exception_detected_=true;
223  }
224 
226  {
227  std::string context;
228  if (to==edm::TerminationOrigin::ExceptionFromThisContext) context = " FromThisContext ";
229  if (to==edm::TerminationOrigin::ExceptionFromAnotherContext) context = " FromAnotherContext";
230  if (to==edm::TerminationOrigin::ExternalSignal) context = " FromExternalSignal";
231  edm::LogInfo("FastMonitoringService") << " GLOBAL " << "earlyTermination -: LS:"
232  << gc.luminosityBlockID().luminosityBlock() << " " << context;
233  std::lock_guard<std::mutex> lock(fmt_.monlock_);
235  //exception_detected_=true;
236  }
237 
239  {
240  std::string context;
241  if (to==edm::TerminationOrigin::ExceptionFromThisContext) context = " FromThisContext ";
242  if (to==edm::TerminationOrigin::ExceptionFromAnotherContext) context = " FromAnotherContext";
243  if (to==edm::TerminationOrigin::ExternalSignal) context = " FromExternalSignal";
244  edm::LogInfo("FastMonitoringService") << " SOURCE " << "earlyTermination -: " << context;
245  std::lock_guard<std::mutex> lock(fmt_.monlock_);
246  exception_detected_=true;
247  }
248 
250  if (!ls) exception_detected_=true;
251  else exceptionInLS_.push_back(ls);
252  }
253 
255  {
257  }
258 
259  //new output module name is stream
261  {
262  std::lock_guard<std::mutex> lock(fmt_.monlock_);
263  //std::cout << " Pre module Begin Job module: " << desc.moduleName() << std::endl;
264 
265  //build a map of modules keyed by their module description address
266  //here we need to treat output modules in a special way so they can be easily singled out
267  if(desc.moduleName() == "Stream" || desc.moduleName() == "ShmStreamConsumer" ||
268  desc.moduleName() == "EventStreamFileWriter" || desc.moduleName() == "PoolOutputModule")
269  encModule_.updateReserved((void*)&desc);
270  else
271  encModule_.update((void*)&desc);
272  }
273 
275  {
276  std::string && moduleLegStr = makeModuleLegenda();
277  FileIO::writeStringToFile(moduleLegendFile_, moduleLegStr);
278 
280 
281  //update number of entries in module histogram
282  std::lock_guard<std::mutex> lock(fmt_.monlock_);
284  }
285 
287  {
289  fmt_.stop();
290  }
291 
293  {
295  }
296 
298  {
299 
300  timeval lumiStartTime;
301  gettimeofday(&lumiStartTime, 0);
302  unsigned int newLumi = gc.luminosityBlockID().luminosityBlock();
303 
304  std::lock_guard<std::mutex> lock(fmt_.monlock_);
305 
306  lumiStartTime_[newLumi]=lumiStartTime;
307  while (!lastGlobalLumisClosed_.empty()) {
308  //wipe out old map entries as they aren't needed and slow down access
309  unsigned int oldLumi = lastGlobalLumisClosed_.back();
311  lumiStartTime_.erase(oldLumi);
312  avgLeadTime_.erase(oldLumi);
313  filesProcessedDuringLumi_.erase(oldLumi);
314  accuSize_.erase(oldLumi);
315  lockStatsDuringLumi_.erase(oldLumi);
316  processedEventsPerLumi_.erase(oldLumi);
317  }
318  lastGlobalLumi_= newLumi;
320  }
321 
323  {
324  unsigned int lumi = gc.luminosityBlockID().luminosityBlock();
325  LogDebug("FastMonitoringService") << "Lumi ended. Writing JSON information. LUMI -: "
326  << lumi;
327  timeval lumiStopTime;
328  gettimeofday(&lumiStopTime, 0);
329 
330  std::lock_guard<std::mutex> lock(fmt_.monlock_);
331 
332  // Compute throughput
333  timeval stt = lumiStartTime_[lumi];
334  unsigned long usecondsForLumi = (lumiStopTime.tv_sec - stt.tv_sec)*1000000
335  + (lumiStopTime.tv_usec - stt.tv_usec);
336  unsigned long accuSize = accuSize_.find(lumi)==accuSize_.end() ? 0 : accuSize_[lumi];
337  double throughput = throughputFactor()* double(accuSize) / double(usecondsForLumi);
338  //store to registered variable
339  fmt_.m_data.fastThroughputJ_.value() = throughput;
340 
341  //update
342  doSnapshot(lumi,true);
343 
344  // create file name for slow monitoring file
345  std::stringstream slowFileName;
346  slowFileName << slowName_ << "_ls" << std::setfill('0') << std::setw(4)
347  << lumi << "_pid" << std::setfill('0')
348  << std::setw(5) << getpid() << ".jsn";
350  slow /= slowFileName.str();
351 
352  //retrieve one result we need (todo: sanity check if it's found)
353  IntJ *lumiProcessedJptr = dynamic_cast<IntJ*>(fmt_.jsonMonitor_->getMergedIntJForLumi("Processed",lumi));
354  if (!lumiProcessedJptr)
355  throw cms::Exception("FastMonitoringService") << "Internal error: got null pointer from FastMonitor";
356  processedEventsPerLumi_[lumi] = lumiProcessedJptr->value();
357 
358  {
359  auto itr = sourceEventsReport_.find(lumi);
360  if (itr==sourceEventsReport_.end()) {
361  //check if exception has been thrown (in case of Global/Stream early termination, for this LS)
362  bool exception_detected = exception_detected_;
363  for (auto ex : exceptionInLS_)
364  if (lumi == ex) exception_detected=true;
365 
366  if (edm::shutdown_flag || exception_detected) {
367  edm::LogInfo("FastMonitoringService") << "Run interrupted. Skip writing EoL information -: "
368  << processedEventsPerLumi_[lumi] << " events were processed in LUMI " << lumi;
369  //this will prevent output modules from producing json file for possibly incomplete lumi
371  return;
372  }
373  //disable this exception, so service can be used standalone (will be thrown if output module asks for this information)
374  //throw cms::Exception("FastMonitoringService") << "SOURCE did not send update for lumi block. LUMI -:" << lumi;
375  }
376  else {
377  if (itr->second!=processedEventsPerLumi_[lumi]) {
378  throw cms::Exception("FastMonitoringService") << "MISMATCH with SOURCE update. LUMI -: "
379  << lumi
380  << ", events(processed):" << processedEventsPerLumi_[lumi]
381  << " events(source):" << itr->second;
382  }
383  sourceEventsReport_.erase(itr);
384  }
385  }
386  edm::LogInfo("FastMonitoringService") << "Statistics for lumisection -: lumi = " << lumi << " events = "
387  << lumiProcessedJptr->value() << " time = " << usecondsForLumi/1000000
388  << " size = " << accuSize << " thr = " << throughput;
389  delete lumiProcessedJptr;
390 
391  //full global and stream merge&output for this lumi
392  fmt_.jsonMonitor_->outputFullJSON(slow.string(),lumi);//full global and stream merge and JSON write for this lumi
393  fmt_.jsonMonitor_->discardCollected(lumi);//we don't do further updates for this lumi
394 
396  }
397 
399  {
400  //mark closed lumis (still keep map entries until next one)
402  }
403 
405  {
406  unsigned int sid = sc.streamID().value();
407  std::lock_guard<std::mutex> lock(fmt_.monlock_);
409 
410  //reset collected values for this stream
411  *(fmt_.m_data.processed_[sid])=0;
412 
413  ministate_[sid]=&nopath_;
415  }
416 
418  {
420  }
421 
423  {
424  unsigned int sid = sc.streamID().value();
425  std::lock_guard<std::mutex> lock(fmt_.monlock_);
426 
427  #if ATOMIC_LEVEL>=2
428  //spinlock to make sure we are not still updating event counter somewhere
429  while (streamCounterUpdating_[sid]->load(std::memory_order_acquire)) {}
430  #endif
431 
432  //update processed count to be complete at this time
434  //reset this in case stream does not get notified of next lumi (we keep processed events only)
435  ministate_[sid]=&nopath_;
437  }
439  {
441  }
442 
443 
445  {
446  //make sure that all path names are retrieved before allowing ministate to change
447  //hack: assume memory is synchronized after ~50 events seen by each stream
448  if (unlikely(eventCountForPathInit_[sc.streamID()]<50) && false==collectedPathList_[sc.streamID()]->load(std::memory_order_acquire))
449  {
450  //protection between stream threads, as well as the service monitoring thread
451  std::lock_guard<std::mutex> lock(fmt_.monlock_);
452 
453  if (firstEventId_[sc.streamID()]==0)
454  firstEventId_[sc.streamID()]=sc.eventID().event();
455  if (sc.eventID().event()==firstEventId_[sc.streamID()])
456  {
457  encPath_[sc.streamID()].update((void*)&pc.pathName());
458  return;
459  }
460  else {
461  //finished collecting path names
462  collectedPathList_[sc.streamID()]->store(true,std::memory_order_seq_cst);
463  fmt_.m_data.ministateBins_=encPath_[sc.streamID()].vecsize();
464  if (!pathLegendWritten_) {
465  std::string pathLegendStr = makePathLegenda();
466  FileIO::writeStringToFile(pathLegendFile_, pathLegendStr);
467  pathLegendWritten_=true;
468  }
469  }
470  }
471  else {
472  ministate_[sc.streamID()] = &(pc.pathName());
473  }
474  }
475 
476 
478  {
479  }
480 
482  {
484 
485  ministate_[sc.streamID()] = &nopath_;
486 
487  #if ATOMIC_LEVEL>=2
488  //use atomic flag to make sure end of lumi sees this
489  streamCounterUpdating_[sc.streamID()]->store(true,std::memory_order_release);
490  fmt_.m_data.processed_[sc.streamID()]->fetch_add(1,std::memory_order_release);
491  streamCounterUpdating_[sc.streamID()]->store(false,std::memory_order_release);
492 
493  #elif ATOMIC_LEVEL==1
494  //writes are atomic, we assume writes propagate to memory before stream EOL snap
495  fmt_.m_data.processed_[sc.streamID()]->fetch_add(1,std::memory_order_relaxed);
496 
497  #elif ATOMIC_LEVEL==0 //default
498  (*(fmt_.m_data.processed_[sc.streamID()]))++;
499  #endif
501 
502  //fast path counter (events accumulated in a run)
503  unsigned long res = totalEventsProcessed_.fetch_add(1,std::memory_order_relaxed);
505  //fmt_.m_data.fastPathProcessedJ_ = totalEventsProcessed_.load(std::memory_order_relaxed);
506  }
507 
509  {
511  }
512 
514  {
516  }
517 
519  {
520  microstate_[sc.streamID().value()] = (void*)(mcc.moduleDescription());
521  }
522 
524  {
525  //microstate_[sc.streamID().value()] = (void*)(mcc.moduleDescription());
527  }
528 
529  //FUNCTIONS CALLED FROM OUTSIDE
530 
531  //this is for old-fashioned service that is not thread safe and can block other streams
532  //(we assume the worst case - everything is blocked)
534  {
535  for (unsigned int i=0;i<nStreams_;i++)
537  }
538 
539  //this is for services that are multithreading-enabled or rarely blocks other streams
541  {
543  }
544 
545  //from source
546  void FastMonitoringService::accumulateFileSize(unsigned int lumi, unsigned long fileSize) {
547  std::lock_guard<std::mutex> lock(fmt_.monlock_);
548 
549  if (accuSize_.find(lumi)==accuSize_.end()) accuSize_[lumi] = fileSize;
550  else accuSize_[lumi] += fileSize;
551 
553  filesProcessedDuringLumi_[lumi] = 1;
554  else
556  }
557 
559  gettimeofday(&fileLookStart_, 0);
560  /*
561  std::cout << "Started looking for .raw file at: s=" << fileLookStart_.tv_sec << ": ms = "
562  << fileLookStart_.tv_usec / 1000.0 << std::endl;
563  */
564  }
565 
567  gettimeofday(&fileLookStop_, 0);
568  /*
569  std::cout << "Stopped looking for .raw file at: s=" << fileLookStop_.tv_sec << ": ms = "
570  << fileLookStop_.tv_usec / 1000.0 << std::endl;
571  */
572  std::lock_guard<std::mutex> lock(fmt_.monlock_);
573 
574  if (lumi>lumiFromSource_) {
576  leadTimes_.clear();
577  }
578  unsigned long elapsedTime = (fileLookStop_.tv_sec - fileLookStart_.tv_sec) * 1000000 // sec to us
579  + (fileLookStop_.tv_usec - fileLookStart_.tv_usec); // us
580  // add this to lead times for this lumi
581  leadTimes_.push_back((double)elapsedTime);
582 
583  // recompute average lead time for this lumi
584  if (leadTimes_.size() == 1) avgLeadTime_[lumi] = leadTimes_[0];
585  else {
586  double totTime = 0;
587  for (unsigned int i = 0; i < leadTimes_.size(); i++) totTime += leadTimes_[i];
588  avgLeadTime_[lumi] = 0.001*(totTime / leadTimes_.size());
589  }
590  }
591 
592  void FastMonitoringService::reportLockWait(unsigned int ls, double waitTime, unsigned int lockCount)
593  {
594  std::lock_guard<std::mutex> lock(fmt_.monlock_);
595  lockStatsDuringLumi_[ls]=std::pair<double,unsigned int>(waitTime,lockCount);
596 
597  }
598 
599  //for the output module
601  std::lock_guard<std::mutex> lock(fmt_.monlock_);
602 
603  auto it = processedEventsPerLumi_.find(lumi);
604  if (it!=processedEventsPerLumi_.end()) {
605  unsigned int proc = it->second;
606  return proc;
607  }
608  else {
609  throw cms::Exception("FastMonitoringService") << "output module wants already deleted (or never reported by SOURCE) lumisection event count for LUMI -: "<<lumi;
610  return 0;
611  }
612  }
613 
614 
615  void FastMonitoringService::doSnapshot(const unsigned int ls, const bool isGlobalEOL) {
616  // update macrostate
618 
619  //update these unless in the midst of a global transition
621 
622  auto itd = avgLeadTime_.find(ls);
623  if (itd != avgLeadTime_.end())
624  fmt_.m_data.fastAvgLeadTimeJ_ = itd->second;
625  else fmt_.m_data.fastAvgLeadTimeJ_=0.;
626 
627  auto iti = filesProcessedDuringLumi_.find(ls);
628  if (iti != filesProcessedDuringLumi_.end())
629  fmt_.m_data.fastFilesProcessedJ_ = iti->second;
631 
632  auto itrd = lockStatsDuringLumi_.find(ls);
633  if (itrd != lockStatsDuringLumi_.end()) {
634  fmt_.m_data.fastLockWaitJ_ = itrd->second.first;
635  fmt_.m_data.fastLockCountJ_ = itrd->second.second;
636  }
637  else {
640  }
641 
642  }
643  else return;
644 
645  //capture latest mini/microstate of streams
646  for (unsigned int i=0;i<nStreams_;i++) {
649  }
650  //for (unsigned int i=0;i<nThreads_;i++)
651  // fmt_.m_data.threadMicrostateEncoded_[i] = encModule_.encode(threadMicrostate_[i]);
652 
653  if (isGlobalEOL)
654  {//only update global variables
655  fmt_.jsonMonitor_->snapGlobal(ls);
656  }
657  else
658  fmt_.jsonMonitor_->snap(ls);
659  }
660 
662  {
663 
664  std::lock_guard<std::mutex> lock(fmt_.monlock_);
665  auto itr = sourceEventsReport_.find(lumi);
666  if (itr!=sourceEventsReport_.end())
667  itr->second+=events;
668  else
669  sourceEventsReport_[lumi]=events;
670 
671  }
672 } //end namespace evf
673 
#define LogDebug(id)
void prePathEvent(edm::StreamContext const &, edm::PathContext const &)
std::string const & pathName() const
Definition: PathContext.h:37
unsigned int maxNumberOfThreads() const
Definition: SystemBounds.h:46
EventNumber_t event() const
Definition: EventID.h:41
void watchPreStreamEarlyTermination(PreStreamEarlyTermination::slot_type const &iSlot)
void watchPreEvent(PreEvent::slot_type const &iSlot)
int i
Definition: DBlmapReader.cc:9
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< AtomicMonUInt * > processed_
void watchPrePathEvent(PrePathEvent::slot_type const &iSlot)
void watchPreallocate(Preallocate::slot_type const &iSlot)
void setExceptionDetected(unsigned int ls)
boost::filesystem::path runDirectory_
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void preallocate(edm::service::SystemBounds const &)
std::map< unsigned int, timeval > lumiStartTime_
void start(void(FastMonitoringService::*fp)(), FastMonitoringService *cp)
void preGlobalBeginLumi(edm::GlobalContext const &)
double throughputFactor()
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void postGlobalEndLumi(edm::GlobalContext const &)
TrainProcessor *const proc
Definition: MVATrainer.cc:101
void postEvent(edm::StreamContext const &)
void accumulateFileSize(unsigned int lumi, unsigned long fileSize)
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
std::map< unsigned int, unsigned long > accuSize_
tuple lumi
Definition: fjr2json.py:35
std::vector< unsigned int > eventCountForPathInit_
std::vector< std::atomic< bool > * > streamCounterUpdating_
void watchPostEvent(PostEvent::slot_type const &iSlot)
LuminosityBlockID const & luminosityBlockID() const
Definition: GlobalContext.h:52
def ls
Definition: eostools.py:346
void watchPostStreamEndLumi(PostStreamEndLumi::slot_type const &iSlot)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
std::string const & moduleName() const
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
volatile std::atomic< bool > shutdown_flag
void doStreamEOLSnapshot(const unsigned int ls, const unsigned int streamID)
std::map< unsigned int, unsigned int > filesProcessedDuringLumi_
void preGlobalEndLumi(edm::GlobalContext const &)
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
void preGlobalEarlyTermination(edm::GlobalContext const &, edm::TerminationOrigin)
#define constexpr
void watchPreSourceEarlyTermination(PreSourceEarlyTermination::slot_type const &iSlot)
void watchJobFailure(JobFailure::slot_type const &iSlot)
convenience function for attaching to signal
void reportEventsThisLumiInSource(unsigned int lumi, unsigned int events)
#define unlikely(x)
unsigned int maxNumberOfStreams() const
Definition: SystemBounds.h:43
unsigned int getEventsProcessedForLumi(unsigned int lumi)
void preModuleBeginJob(edm::ModuleDescription const &)
std::vector< std::atomic< bool > * > collectedPathList_
tuple path
else: Piece not in the list, fine.
std::queue< unsigned int > lastGlobalLumisClosed_
void preStreamEndLumi(edm::StreamContext const &)
std::map< unsigned int, double > avgLeadTime_
void watchPostStreamBeginLumi(PostStreamBeginLumi::slot_type const &iSlot)
void doSnapshot(const unsigned int ls, const bool isGlobalEOL)
void preStreamEarlyTermination(edm::StreamContext const &, edm::TerminationOrigin)
void watchPreGlobalEarlyTermination(PreGlobalEarlyTermination::slot_type const &iSlot)
static const std::string nopath_
def load
Definition: svgfig.py:546
ModuleDescription const * moduleDescription() const
void resetFastMonitor(std::string const &microStateDefPath, std::string const &fastMicroStateDefPath)
bool decode(bool &, std::string const &)
Definition: types.cc:62
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
std::map< unsigned int, std::pair< double, unsigned int > > lockStatsDuringLumi_
std::vector< unsigned long > firstEventId_
static const std::string macroStateNames[FastMonitoringThread::MCOUNT]
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postStreamBeginLumi(edm::StreamContext const &)
StreamID const & streamID() const
Definition: StreamContext.h:57
void postStreamEndLumi(edm::StreamContext const &)
std::vector< const void * > microstate_
std::vector< unsigned int > microstateEncoded_
unsigned int value() const
Definition: StreamID.h:46
void preStreamBeginLumi(edm::StreamContext const &)
void registerVariables(FastMonitor *fm, unsigned int nStreams, unsigned int nThreads)
std::atomic< unsigned long > totalEventsProcessed_
LuminosityBlockNumber_t luminosityBlock() const
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
FastMonitoringThread::Macrostate macrostate_
std::vector< double > leadTimes_
void stoppedLookingForFile(unsigned int lumi)
void setMicroState(MicroStateService::Microstate)
tuple events
Definition: patZpeak.py:19
boost::filesystem::path workingDirectory_
std::map< unsigned int, unsigned int > processedEventsPerLumi_
std::map< unsigned int, unsigned int > sourceEventsReport_
std::unique_ptr< FastMonitor > jsonMonitor_
void postGlobalBeginRun(edm::GlobalContext const &)
void preEvent(edm::StreamContext const &)
void preSourceEarlyTermination(edm::TerminationOrigin)
EventID const & eventID() const
Definition: StreamContext.h:59
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
std::vector< const void * > ministate_
const void * decode(unsigned int index)
std::vector< unsigned int > streamLumi_
std::vector< Encoding > encPath_
std::vector< unsigned int > ministateEncoded_
FastMonitoringService(const edm::ParameterSet &, edm::ActivityRegistry &)
void reportLockWait(unsigned int ls, double waitTime, unsigned int lockCount)
std::vector< unsigned int > exceptionInLS_
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal