test
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 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 accumulateFileSize (unsigned int lumi, unsigned long fileSize)
 
 FastMonitoringService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
bool getAbortFlagForLumi (unsigned int lumi)
 
unsigned int getEventsProcessedForLumi (unsigned int lumi, bool *abortFlag=0)
 
std::string getRunDirName () const
 
void jobFailure ()
 
std::string makeInputLegendaJson ()
 
std::string makeModuleLegendaJson ()
 
std::string makePathLegendaJson ()
 
void postBeginJob ()
 
void postEndJob ()
 
void postEvent (edm::StreamContext const &)
 
void postGlobalBeginRun (edm::GlobalContext const &)
 
void postGlobalEndLumi (edm::GlobalContext const &)
 
void postModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void postSourceEvent (edm::StreamID)
 
void postStreamBeginLumi (edm::StreamContext const &)
 
void postStreamEndLumi (edm::StreamContext const &)
 
void preallocate (edm::service::SystemBounds const &)
 
void preBeginJob (edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &pc)
 
void preEvent (edm::StreamContext const &)
 
void preGlobalBeginLumi (edm::GlobalContext const &)
 
void preGlobalEarlyTermination (edm::GlobalContext const &, edm::TerminationOrigin)
 
void preGlobalEndLumi (edm::GlobalContext const &)
 
void preModuleBeginJob (edm::ModuleDescription const &)
 
void preModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void prePathEvent (edm::StreamContext const &, edm::PathContext const &)
 
void preSourceEarlyTermination (edm::TerminationOrigin)
 
void preSourceEvent (edm::StreamID)
 
void preStreamBeginLumi (edm::StreamContext const &)
 
void preStreamEarlyTermination (edm::StreamContext const &, edm::TerminationOrigin)
 
void preStreamEndLumi (edm::StreamContext const &)
 
void reportLockWait (unsigned int ls, double waitTime, unsigned int lockCount)
 
void setExceptionDetected (unsigned int ls)
 
void setInputSource (FedRawDataInputSource *inputSource)
 
void setInState (FastMonitoringThread::InputState inputState)
 
void setInStateSup (FastMonitoringThread::InputState inputState)
 
void setMicroState (MicroStateService::Microstate)
 
void setMicroState (edm::StreamID, MicroStateService::Microstate)
 
bool shouldWriteFiles (unsigned int lumi, unsigned int *proc=0)
 
void startedLookingForFile ()
 
void stoppedLookingForFile (unsigned int lumi)
 
 ~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 Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Static Public Attributes

static const std::string inputStateNames [FastMonitoringThread::inCOUNT]
 
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 doSnapshot (const unsigned int ls, const bool isGlobalEOL)
 
void doStreamEOLSnapshot (const unsigned int ls, const unsigned int streamID)
 
void dowork ()
 

Private Attributes

std::map< unsigned int,
unsigned long > 
accuSize_
 
std::map< unsigned int, double > avgLeadTime_
 
std::vector< std::atomic< bool > * > collectedPathList_
 
bool emptyLumisectionMode_ = false
 
Encoding encModule_
 
std::vector< EncodingencPath_
 
std::vector< unsigned int > eventCountForPathInit_
 
bool exception_detected_ = false
 
std::vector< unsigned int > exceptionInLS_
 
std::string fastMicrostateDefPath_
 
unsigned int fastMonIntervals_
 
std::string fastName_
 
std::string fastPath_
 
std::vector< std::string > fastPathList_
 
timeval fileLookStart_
 
timeval fileLookStop_
 
bool filePerFwkStream_
 
std::map< unsigned int,
unsigned int > 
filesProcessedDuringLumi_
 
std::vector< unsigned long > firstEventId_
 
FastMonitoringThread fmt_
 
std::string inputLegendFileJson_
 
FedRawDataInputSourceinputSource_ = 0
 
FastMonitoringThread::InputState inputState_
 
FastMonitoringThread::InputState inputSupervisorState_
 
bool isGlobalLumiTransition_
 
unsigned int lastGlobalLumi_
 
std::queue< unsigned int > lastGlobalLumisClosed_
 
std::vector< double > leadTimes_
 
std::map< unsigned int,
std::pair< double, unsigned
int > > 
lockStatsDuringLumi_
 
unsigned int lumiFromSource_
 
std::map< unsigned int, timeval > lumiStartTime_
 
FastMonitoringThread::Macrostate macrostate_
 
std::vector< const void * > microstate_
 
std::string microstateDefPath_
 
std::vector< const void * > ministate_
 
std::string moduleLegendFile_
 
std::string moduleLegendFileJson_
 
std::atomic< bool > monInit_
 
unsigned int nOutputModules_ =0
 
unsigned int nStreams_
 
unsigned int nThreads_
 
std::string pathLegendFile_
 
std::string pathLegendFileJson_
 
bool pathLegendWritten_ = false
 
std::vector< bool > pathNamesReady_
 
std::map< unsigned int,
std::pair< unsigned int, bool > > 
processedEventsPerLumi_
 
boost::filesystem::path runDirectory_
 
int sleepTime_
 
std::string slowName_
 
unsigned int snapCounter_ = 0
 
std::vector< std::atomic< bool > * > streamCounterUpdating_
 
bool threadIDAvailable_ = false
 
std::vector< const void * > threadMicrostate_
 
std::atomic< unsigned long > totalEventsProcessed_
 
boost::filesystem::path workingDirectory_
 

Additional Inherited Members

- Public Types inherited from evf::MicroStateService
enum  Microstate {
  mInvalid = 0, mIdle, mFwkOvhSrc, mFwkOvhMod,
  mFwkEoL, mInput, mDqm, mBoL,
  mEoL, mGlobEoL, mCOUNT
}
 
- Static Protected Attributes inherited from evf::MicroStateService
static const std::string default_return_ ="NotImplemented"
 

Detailed Description

Definition at line 57 of file FastMonitoringService.h.

Constructor & Destructor Documentation

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

Definition at line 60 of file FastMonitoringService.cc.

References Exception, fastMicrostateDefPath_, jobFailure(), microstateDefPath_, postBeginJob(), postEndJob(), postEvent(), postGlobalEndLumi(), postModuleEvent(), postSourceEvent(), postStreamBeginLumi(), postStreamEndLumi(), preallocate(), preBeginJob(), preEvent(), preGlobalBeginLumi(), preGlobalEarlyTermination(), preGlobalEndLumi(), preModuleBeginJob(), preModuleEvent(), prePathEvent(), preSourceEarlyTermination(), preSourceEvent(), preStreamBeginLumi(), preStreamEarlyTermination(), preStreamEndLumi(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ActivityRegistry::watchJobFailure(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostEvent(), edm::ActivityRegistry::watchPostGlobalEndLumi(), edm::ActivityRegistry::watchPostModuleEvent(), edm::ActivityRegistry::watchPostSourceEvent(), edm::ActivityRegistry::watchPostStreamBeginLumi(), edm::ActivityRegistry::watchPostStreamEndLumi(), edm::ActivityRegistry::watchPreallocate(), edm::ActivityRegistry::watchPreBeginJob(), edm::ActivityRegistry::watchPreEvent(), edm::ActivityRegistry::watchPreGlobalBeginLumi(), edm::ActivityRegistry::watchPreGlobalEarlyTermination(), edm::ActivityRegistry::watchPreGlobalEndLumi(), edm::ActivityRegistry::watchPreModuleBeginJob(), edm::ActivityRegistry::watchPreModuleEvent(), edm::ActivityRegistry::watchPrePathEvent(), edm::ActivityRegistry::watchPreSourceEarlyTermination(), edm::ActivityRegistry::watchPreSourceEvent(), edm::ActivityRegistry::watchPreStreamBeginLumi(), edm::ActivityRegistry::watchPreStreamEarlyTermination(), and edm::ActivityRegistry::watchPreStreamEndLumi().

61  :
62  MicroStateService(iPS,reg)
64  ,nStreams_(0)//until initialized
65  ,sleepTime_(iPS.getUntrackedParameter<int>("sleepTime", 1))
66  ,fastMonIntervals_(iPS.getUntrackedParameter<unsigned int>("fastMonIntervals", 2))
67  ,fastName_("fastmoni")
68  ,slowName_("slowmoni")
69  ,filePerFwkStream_(iPS.getUntrackedParameter<bool>("filePerFwkStream", false))
71  {
72  reg.watchPreallocate(this, &FastMonitoringService::preallocate);//receiving information on number of threads
74 
79 
83 
88 
90 
93 
94  reg.watchPreSourceEvent(this,&FastMonitoringService::preSourceEvent);//source (with streamID of requestor)
96 
99 
103 
104  //find microstate definition path (required by the module)
105  struct stat statbuf;
106  std::string microstateBaseSuffix = "src/EventFilter/Utilities/plugins/microstatedef.jsd";
107  std::string microstatePath = std::string(getenv("CMSSW_BASE")) + "/" + microstateBaseSuffix;
108  if (stat(microstatePath.c_str(), &statbuf)) {
109  microstatePath = std::string(getenv("CMSSW_RELEASE_BASE")) + "/" + microstateBaseSuffix;
110  if (stat(microstatePath.c_str(), &statbuf)) {
111  microstatePath = microstateBaseSuffix;
112  if (stat(microstatePath.c_str(), &statbuf))
113  throw cms::Exception("FastMonitoringService") << "microstate definition file not found";
114  }
115  }
116  fastMicrostateDefPath_ = microstateDefPath_ = microstatePath;
117  }
void prePathEvent(edm::StreamContext const &, edm::PathContext const &)
void watchPreStreamEarlyTermination(PreStreamEarlyTermination::slot_type const &iSlot)
T getUntrackedParameter(std::string const &, T const &) const
void watchPreEvent(PreEvent::slot_type const &iSlot)
void watchPrePathEvent(PrePathEvent::slot_type const &iSlot)
void watchPreallocate(Preallocate::slot_type const &iSlot)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void preallocate(edm::service::SystemBounds const &)
void preGlobalBeginLumi(edm::GlobalContext const &)
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void postGlobalEndLumi(edm::GlobalContext const &)
void postEvent(edm::StreamContext const &)
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void watchPostStreamEndLumi(PostStreamEndLumi::slot_type const &iSlot)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
void watchPostSourceEvent(PostSourceEvent::slot_type const &iSlot)
void preGlobalEndLumi(edm::GlobalContext const &)
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
void preGlobalEarlyTermination(edm::GlobalContext const &, edm::TerminationOrigin)
void watchPreSourceEarlyTermination(PreSourceEarlyTermination::slot_type const &iSlot)
void watchJobFailure(JobFailure::slot_type const &iSlot)
convenience function for attaching to signal
void preModuleBeginJob(edm::ModuleDescription const &)
MicroStateService(const edm::ParameterSet &, edm::ActivityRegistry &)
void preStreamEndLumi(edm::StreamContext const &)
void watchPostStreamBeginLumi(PostStreamBeginLumi::slot_type const &iSlot)
void preStreamEarlyTermination(edm::StreamContext const &, edm::TerminationOrigin)
void watchPreGlobalEarlyTermination(PreGlobalEarlyTermination::slot_type const &iSlot)
static const int nReservedModules
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
void watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
void postStreamBeginLumi(edm::StreamContext const &)
void postStreamEndLumi(edm::StreamContext const &)
void preStreamBeginLumi(edm::StreamContext const &)
std::atomic< unsigned long > totalEventsProcessed_
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &pc)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
void preEvent(edm::StreamContext const &)
void preSourceEarlyTermination(edm::TerminationOrigin)
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
evf::FastMonitoringService::~FastMonitoringService ( )

Definition at line 120 of file FastMonitoringService.cc.

121  {
122  }

Member Function Documentation

void evf::FastMonitoringService::accumulateFileSize ( unsigned int  lumi,
unsigned long  fileSize 
)

Definition at line 653 of file FastMonitoringService.cc.

References accuSize_, filesProcessedDuringLumi_, fmt_, CommonMethods::lock(), fjr2json::lumi, and evf::FastMonitoringThread::monlock_.

Referenced by evf::EvFDaqDirector::bumpFile().

653  {
654  std::lock_guard<std::mutex> lock(fmt_.monlock_);
655 
656  if (accuSize_.find(lumi)==accuSize_.end()) accuSize_[lumi] = fileSize;
657  else accuSize_[lumi] += fileSize;
658 
661  else
663  }
std::map< unsigned int, unsigned long > accuSize_
tuple lumi
Definition: fjr2json.py:35
std::map< unsigned int, unsigned int > filesProcessedDuringLumi_
void evf::FastMonitoringService::doSnapshot ( const unsigned int  ls,
const bool  isGlobalEOL 
)
private

Definition at line 737 of file FastMonitoringService.cc.

References avgLeadTime_, encModule_, evf::FastMonitoringService::Encoding::encode(), encPath_, evf::FastMonitoringThread::MonitorData::fastAvgLeadTimeJ_, evf::FastMonitoringThread::MonitorData::fastFilesProcessedJ_, evf::FastMonitoringThread::MonitorData::fastLockCountJ_, evf::FastMonitoringThread::MonitorData::fastLockWaitJ_, evf::FastMonitoringThread::MonitorData::fastMacrostateJ_, filesProcessedDuringLumi_, fmt_, i, evf::FastMonitoringThread::inNoRequest, evf::FastMonitoringThread::inNoRequestWithAllEoLThreads, evf::FastMonitoringThread::inNoRequestWithEoLThreads, evf::FastMonitoringThread::inNoRequestWithGlobalEoL, evf::FastMonitoringThread::inNoRequestWithIdleAndEoLThreads, evf::FastMonitoringThread::inNoRequestWithIdleThreads, evf::FastMonitoringThread::MonitorData::inputState_, inputState_, inputSupervisorState_, evf::FastMonitoringThread::inRunEnd, evf::FastMonitoringThread::inSupBusy, evf::FastMonitoringThread::inSupFileLimit, evf::FastMonitoringThread::inSupLockPolling, evf::FastMonitoringThread::inSupLockPollingCopying, evf::FastMonitoringThread::inSupNewFile, evf::FastMonitoringThread::inSupNewFileWaitChunk, evf::FastMonitoringThread::inSupNewFileWaitChunkCopying, evf::FastMonitoringThread::inSupNewFileWaitThread, evf::FastMonitoringThread::inSupNewFileWaitThreadCopying, evf::FastMonitoringThread::inSupNoFile, evf::FastMonitoringThread::inSupWaitFreeChunk, evf::FastMonitoringThread::inSupWaitFreeChunkCopying, evf::FastMonitoringThread::inSupWaitFreeThread, evf::FastMonitoringThread::inSupWaitFreeThreadCopying, evf::FastMonitoringThread::inWaitChunk, evf::FastMonitoringThread::inWaitChunk_busy, evf::FastMonitoringThread::inWaitChunk_fileLimit, evf::FastMonitoringThread::inWaitChunk_lockPolling, evf::FastMonitoringThread::inWaitChunk_lockPollingCopying, evf::FastMonitoringThread::inWaitChunk_newFile, evf::FastMonitoringThread::inWaitChunk_newFileWaitChunk, evf::FastMonitoringThread::inWaitChunk_newFileWaitChunkCopying, evf::FastMonitoringThread::inWaitChunk_newFileWaitThread, evf::FastMonitoringThread::inWaitChunk_newFileWaitThreadCopying, evf::FastMonitoringThread::inWaitChunk_noFile, evf::FastMonitoringThread::inWaitChunk_runEnd, evf::FastMonitoringThread::inWaitChunk_waitFreeChunk, evf::FastMonitoringThread::inWaitChunk_waitFreeChunkCopying, evf::FastMonitoringThread::inWaitChunk_waitFreeThread, evf::FastMonitoringThread::inWaitChunk_waitFreeThreadCopying, evf::FastMonitoringThread::inWaitInput, evf::FastMonitoringThread::inWaitInput_busy, evf::FastMonitoringThread::inWaitInput_fileLimit, evf::FastMonitoringThread::inWaitInput_lockPolling, evf::FastMonitoringThread::inWaitInput_lockPollingCopying, evf::FastMonitoringThread::inWaitInput_newFile, evf::FastMonitoringThread::inWaitInput_newFileWaitChunk, evf::FastMonitoringThread::inWaitInput_newFileWaitChunkCopying, evf::FastMonitoringThread::inWaitInput_newFileWaitThread, evf::FastMonitoringThread::inWaitInput_newFileWaitThreadCopying, evf::FastMonitoringThread::inWaitInput_noFile, evf::FastMonitoringThread::inWaitInput_runEnd, evf::FastMonitoringThread::inWaitInput_waitFreeChunk, evf::FastMonitoringThread::inWaitInput_waitFreeChunkCopying, evf::FastMonitoringThread::inWaitInput_waitFreeThread, evf::FastMonitoringThread::inWaitInput_waitFreeThreadCopying, isGlobalLumiTransition_, evf::FastMonitoringThread::jsonMonitor_, lockStatsDuringLumi_, evf::FastMonitoringThread::m_data, macrostate_, evf::MicroStateService::mEoL, evf::MicroStateService::mGlobEoL, microstate_, evf::FastMonitoringThread::MonitorData::microstateEncoded_, evf::MicroStateService::mIdle, ministate_, evf::FastMonitoringThread::MonitorData::ministateEncoded_, nStreams_, and evf::MicroStateService::reservedMicroStateNames.

Referenced by dowork(), and preGlobalEndLumi().

737  {
738  // update macrostate
740 
741  //update these unless in the midst of a global transition
743 
744  auto itd = avgLeadTime_.find(ls);
745  if (itd != avgLeadTime_.end())
746  fmt_.m_data.fastAvgLeadTimeJ_ = itd->second;
747  else fmt_.m_data.fastAvgLeadTimeJ_=0.;
748 
749  auto iti = filesProcessedDuringLumi_.find(ls);
750  if (iti != filesProcessedDuringLumi_.end())
751  fmt_.m_data.fastFilesProcessedJ_ = iti->second;
753 
754  auto itrd = lockStatsDuringLumi_.find(ls);
755  if (itrd != lockStatsDuringLumi_.end()) {
756  fmt_.m_data.fastLockWaitJ_ = itrd->second.first;
757  fmt_.m_data.fastLockCountJ_ = itrd->second.second;
758  }
759  else {
762  }
763  }
764  else {
765  for (unsigned int i=0;i<nStreams_;i++) {
767  }
768  }
769  //else return;
770  //capture latest mini/microstate of streams
771  bool anyThreadsIdle=false;
772  bool anyThreadsEoL=false;
773  bool allThreadsEoL=true;
774  for (unsigned int i=0;i<nStreams_;i++) {
777  if (microstate_[i]==&reservedMicroStateNames[mIdle]) anyThreadsIdle=true;
778  if (microstate_[i]==&reservedMicroStateNames[mEoL]) anyThreadsEoL=true;
779  else allThreadsEoL=false;
780  }
781 
783  switch (inputSupervisorState_) {
786  break;
789  break;
792  break;
795  break;
798  break;
801  break;
804  break;
807  break;
810  break;
813  break;
816  break;
819  break;
822  break;
825  break;
828  break;
829  default:
831  }
832  }
834 
835  switch (inputSupervisorState_) {
838  break;
841  break;
844  break;
847  break;
850  break;
853  break;
856  break;
859  break;
862  break;
865  break;
868  break;
871  break;
874  break;
877  break;
880  break;
881  default:
883  }
884  }
888  else if (anyThreadsEoL && anyThreadsIdle)
890  else if (anyThreadsIdle)
892  else if (anyThreadsEoL)
894  else if (allThreadsEoL)
896  else
898  }
899  else
901 
902  //for (unsigned int i=0;i<nThreads_;i++)
903  // fmt_.m_data.threadMicrostateEncoded_[i] = encModule_.encode(threadMicrostate_[i]);
904 
905  if (isGlobalEOL)
906  {//only update global variables
907  fmt_.jsonMonitor_->snapGlobal(ls);
908  }
909  else
910  fmt_.jsonMonitor_->snap(ls);
911  }
FastMonitoringThread::InputState inputState_
int i
Definition: DBlmapReader.cc:9
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
def ls
Definition: eostools.py:348
std::map< unsigned int, unsigned int > filesProcessedDuringLumi_
FastMonitoringThread::InputState inputSupervisorState_
std::map< unsigned int, double > avgLeadTime_
std::unique_ptr< jsoncollector::FastMonitor > jsonMonitor_
std::map< unsigned int, std::pair< double, unsigned int > > lockStatsDuringLumi_
std::vector< const void * > microstate_
std::vector< unsigned int > microstateEncoded_
FastMonitoringThread::Macrostate macrostate_
std::vector< const void * > ministate_
std::vector< Encoding > encPath_
std::vector< unsigned int > inputState_
std::vector< unsigned int > ministateEncoded_
void evf::FastMonitoringService::doStreamEOLSnapshot ( const unsigned int  ls,
const unsigned int  streamID 
)
inlineprivate

Definition at line 181 of file FastMonitoringService.h.

References fmt_, and evf::FastMonitoringThread::jsonMonitor_.

Referenced by preStreamEndLumi().

181  {
182  //pick up only event count here
183  fmt_.jsonMonitor_->snapStreamAtomic(ls,streamID);
184  }
def ls
Definition: eostools.py:348
std::unique_ptr< jsoncollector::FastMonitor > jsonMonitor_
void evf::FastMonitoringService::dowork ( )
inlineprivate

Definition at line 186 of file FastMonitoringService.h.

References doSnapshot(), encModule_, evf::FastMonitoringService::Encoding::encode(), encPath_, evf::FastMonitoringThread::MonitorData::fastMacrostateJ_, fastMonIntervals_, fastPath_, fastPathList_, filePerFwkStream_, fmt_, i, inputState_, inputStateNames, inputSupervisorState_, evf::FastMonitoringThread::jsonMonitor_, lastGlobalLumi_, CommonMethods::lock(), evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::m_stoprequest, microstate_, ministate_, monInit_, evf::FastMonitoringThread::monlock_, nStreams_, findQualityFiles::size, sleepTime_, snapCounter_, AlCaHLTBitMon_QueryRunRegistry::string, and jsoncollector::IntJ::value().

Referenced by preBeginJob().

186  { // the function to be called in the thread. Thread completes when function returns.
187  monInit_.exchange(true,std::memory_order_acquire);
188  while (!fmt_.m_stoprequest) {
189  edm::LogInfo("FastMonitoringService") << "Current states: Ms=" << fmt_.m_data.fastMacrostateJ_.value()
190  << " ms=" << encPath_[0].encode(ministate_[0])
191  << " us=" << encModule_.encode(microstate_[0])
192  << " is=" << inputStateNames[inputState_]
194  << std::endl;
195 
196  {
197  std::lock_guard<std::mutex> lock(fmt_.monlock_);
198 
200 
202  if (filePerFwkStream_) {
203  std::vector<std::string> CSVv;
204  for (unsigned int i=0;i<nStreams_;i++) {
205  CSVv.push_back(fmt_.jsonMonitor_->getCSVString((int)i));
206  }
207  fmt_.monlock_.unlock();
208  for (unsigned int i=0;i<nStreams_;i++) {
209  if (CSVv[i].size())
210  fmt_.jsonMonitor_->outputCSV(fastPathList_[i],CSVv[i]);
211  }
212  }
213  else {
214  std::string CSV = fmt_.jsonMonitor_->getCSVString();
215  //release mutex before writing out fast path file
216  fmt_.monlock_.unlock();
217  if (CSV.size())
218  fmt_.jsonMonitor_->outputCSV(fastPath_,CSV);
219  }
220  }
221 
222  snapCounter_++;
223 
224  }
225  ::sleep(sleepTime_);
226  }
227  }
FastMonitoringThread::InputState inputState_
int i
Definition: DBlmapReader.cc:9
FastMonitoringThread::InputState inputSupervisorState_
static const std::string inputStateNames[FastMonitoringThread::inCOUNT]
void doSnapshot(const unsigned int ls, const bool isGlobalEOL)
std::unique_ptr< jsoncollector::FastMonitor > jsonMonitor_
std::vector< std::string > fastPathList_
std::vector< const void * > microstate_
std::atomic< bool > m_stoprequest
std::vector< const void * > ministate_
std::vector< Encoding > encPath_
tuple size
Write out results.
void evf::FastMonitoringService::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 124 of file FastMonitoringService.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::setAllowAnything(), and edm::ParameterSetDescription::setComment().

125  {
127  desc.setComment("Service for File-based DAQ monitoring and event accounting");
128  desc.addUntracked<int> ("sleepTime",1)->setComment("Sleep time of the monitoring thread");
129  desc.addUntracked<unsigned int> ("fastMonIntervals",2)->setComment("Modulo of sleepTime intervals on which fastmon file is written out");
130  desc.addUntracked<bool> ("filePerFwkStream", false)->setComment("Switches on monitoring output per framework stream");
131  desc.setAllowAnything();
132  descriptions.add("FastMonitoringService", desc);
133  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool evf::FastMonitoringService::getAbortFlagForLumi ( unsigned int  lumi)

Definition at line 723 of file FastMonitoringService.cc.

References Exception, fmt_, CommonMethods::lock(), fjr2json::lumi, evf::FastMonitoringThread::monlock_, and processedEventsPerLumi_.

Referenced by shouldWriteFiles().

723  {
724  std::lock_guard<std::mutex> lock(fmt_.monlock_);
725 
726  auto it = processedEventsPerLumi_.find(lumi);
727  if (it!=processedEventsPerLumi_.end()) {
728  unsigned int abortFlag = it->second.second;
729  return abortFlag;
730  }
731  else {
732  throw cms::Exception("FastMonitoringService") << "output module wants already deleted (or never reported by SOURCE) lumisection status for LUMI -: "<<lumi;
733  return 0;
734  }
735  }
tuple lumi
Definition: fjr2json.py:35
std::map< unsigned int, std::pair< unsigned int, bool > > processedEventsPerLumi_
unsigned int evf::FastMonitoringService::getEventsProcessedForLumi ( unsigned int  lumi,
bool *  abortFlag = 0 
)

Definition at line 707 of file FastMonitoringService.cc.

References Exception, fmt_, CommonMethods::lock(), fjr2json::lumi, evf::FastMonitoringThread::monlock_, proc, and processedEventsPerLumi_.

Referenced by dqm::DQMFileSaverPB::fillJson(), DQMFileSaver::fillJson(), DQMFileSaver::saveForFilterUnit(), dqm::DQMFileSaverPB::saveLumi(), and shouldWriteFiles().

707  {
708  std::lock_guard<std::mutex> lock(fmt_.monlock_);
709 
710  auto it = processedEventsPerLumi_.find(lumi);
711  if (it!=processedEventsPerLumi_.end()) {
712  unsigned int proc = it->second.first;
713  if (abortFlag) *abortFlag=it->second.second;
714  return proc;
715  }
716  else {
717  throw cms::Exception("FastMonitoringService") << "output module wants already deleted (or never reported by SOURCE) lumisection event count for LUMI -: "<<lumi;
718  return 0;
719  }
720  }
TrainProcessor *const proc
Definition: MVATrainer.cc:101
tuple lumi
Definition: fjr2json.py:35
std::map< unsigned int, std::pair< unsigned int, bool > > processedEventsPerLumi_
std::string evf::FastMonitoringService::getRunDirName ( ) const
inline

Definition at line 172 of file FastMonitoringService.h.

References runDirectory_.

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

Definition at line 164 of file FastMonitoringService.cc.

References Json::Value::append(), Json::arrayValue, i, evf::FastMonitoringThread::inCOUNT, inputStateNames, and Json::StyledWriter::write().

Referenced by postBeginJob().

164  {
165  Json::Value legendaVector(Json::arrayValue);
166  for(int i = 0; i < FastMonitoringThread::inCOUNT; i++)
167  legendaVector.append(Json::Value(inputStateNames[i]));
168  Json::Value moduleLegend;
169  moduleLegend["names"]=legendaVector;
170  Json::StyledWriter writer;
171  return writer.write(moduleLegend);
172  }
int i
Definition: DBlmapReader.cc:9
Represents a JSON value.
Definition: value.h:111
static const std::string inputStateNames[FastMonitoringThread::inCOUNT]
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
array value (ordered list)
Definition: value.h:31
std::string evf::FastMonitoringService::makeModuleLegendaJson ( )

Definition at line 148 of file FastMonitoringService.cc.

References Json::Value::append(), Json::arrayValue, evf::FastMonitoringService::Encoding::current_, evf::FastMonitoringService::Encoding::decode(), encModule_, i, nOutputModules_, nReservedModules, nSpecialModules, and Json::StyledWriter::write().

Referenced by postBeginJob().

148  {
149  Json::Value legendaVector(Json::arrayValue);
150  for(int i = 0; i < encModule_.current_; i++)
151  legendaVector.append(Json::Value((static_cast<const edm::ModuleDescription *>(encModule_.decode(i)))->moduleLabel()));
152  Json::Value valReserved(nReservedModules);
153  Json::Value valSpecial(nSpecialModules);
154  Json::Value valOutputModules(nOutputModules_);
155  Json::Value moduleLegend;
156  moduleLegend["names"]=legendaVector;
157  moduleLegend["reserved"]=valReserved;
158  moduleLegend["special"]=valSpecial;
159  moduleLegend["output"]=valOutputModules;
160  Json::StyledWriter writer;
161  return writer.write(moduleLegend);
162  }
int i
Definition: DBlmapReader.cc:9
Represents a JSON value.
Definition: value.h:111
static const int nReservedModules
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
static const int nSpecialModules
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
const void * decode(unsigned int index)
array value (ordered list)
Definition: value.h:31
std::string evf::FastMonitoringService::makePathLegendaJson ( )

Definition at line 136 of file FastMonitoringService.cc.

References Json::Value::append(), Json::arrayValue, encPath_, i, nReservedPaths, and Json::StyledWriter::write().

Referenced by prePathEvent().

136  {
137  Json::Value legendaVector(Json::arrayValue);
138  for(int i = 0; i < encPath_[0].current_; i++)
139  legendaVector.append(Json::Value(*(static_cast<const std::string *>(encPath_[0].decode(i)))));
140  Json::Value valReserved(nReservedPaths);
141  Json::Value pathLegend;
142  pathLegend["names"]=legendaVector;
143  pathLegend["reserved"]=valReserved;
144  Json::StyledWriter writer;
145  return writer.write(pathLegend);
146  }
int i
Definition: DBlmapReader.cc:9
static const int nReservedPaths
Represents a JSON value.
Definition: value.h:111
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:65
std::vector< Encoding > encPath_
array value (ordered list)
Definition: value.h:31
void evf::FastMonitoringService::postBeginJob ( )

Definition at line 368 of file FastMonitoringService.cc.

References encModule_, fmt_, inputLegendFileJson_, CommonMethods::lock(), evf::FastMonitoringThread::m_data, macrostate_, makeInputLegendaJson(), makeModuleLegendaJson(), evf::FastMonitoringThread::MonitorData::microstateBins_, moduleLegendFileJson_, evf::FastMonitoringThread::monlock_, evf::FastMonitoringThread::sJobReady, AlCaHLTBitMon_QueryRunRegistry::string, and evf::FastMonitoringService::Encoding::vecsize().

Referenced by FastMonitoringService().

369  {
370  std::string && moduleLegStrJson = makeModuleLegendaJson();
371  FileIO::writeStringToFile(moduleLegendFileJson_, moduleLegStrJson);
372 
373  std::string inputLegendStrJson = makeInputLegendaJson();
374  FileIO::writeStringToFile(inputLegendFileJson_, inputLegendStrJson);
375 
377 
378  //update number of entries in module histogram
379  std::lock_guard<std::mutex> lock(fmt_.monlock_);
381  }
FastMonitoringThread::Macrostate macrostate_
void evf::FastMonitoringService::postEndJob ( )
void evf::FastMonitoringService::postEvent ( edm::StreamContext const &  sc)

Definition at line 588 of file FastMonitoringService.cc.

References eventCountForPathInit_, evf::FastMonitoringThread::MonitorData::fastPathProcessedJ_, fmt_, evf::FastMonitoringThread::m_data, microstate_, evf::MicroStateService::mIdle, ministate_, nopath_, evf::FastMonitoringThread::MonitorData::processed_, evf::MicroStateService::reservedMicroStateNames, streamCounterUpdating_, edm::StreamContext::streamID(), and totalEventsProcessed_.

Referenced by FastMonitoringService().

589  {
590  microstate_[sc.streamID()] = &reservedMicroStateNames[mIdle];
591 
592  ministate_[sc.streamID()] = &nopath_;
593 
594  #if ATOMIC_LEVEL>=2
595  //use atomic flag to make sure end of lumi sees this
596  streamCounterUpdating_[sc.streamID()]->store(true,std::memory_order_release);
597  fmt_.m_data.processed_[sc.streamID()]->fetch_add(1,std::memory_order_release);
598  streamCounterUpdating_[sc.streamID()]->store(false,std::memory_order_release);
599 
600  #elif ATOMIC_LEVEL==1
601  //writes are atomic, we assume writes propagate to memory before stream EOL snap
602  fmt_.m_data.processed_[sc.streamID()]->fetch_add(1,std::memory_order_relaxed);
603 
604  #elif ATOMIC_LEVEL==0 //default
605  (*(fmt_.m_data.processed_[sc.streamID()]))++;
606  #endif
607  eventCountForPathInit_[sc.streamID()]++;
608 
609  //fast path counter (events accumulated in a run)
610  unsigned long res = totalEventsProcessed_.fetch_add(1,std::memory_order_relaxed);
612  //fmt_.m_data.fastPathProcessedJ_ = totalEventsProcessed_.load(std::memory_order_relaxed);
613  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< unsigned int > eventCountForPathInit_
std::vector< std::atomic< bool > * > streamCounterUpdating_
static const std::string nopath_
std::vector< const void * > microstate_
std::atomic< unsigned long > totalEventsProcessed_
std::vector< jsoncollector::AtomicMonUInt * > processed_
std::vector< const void * > ministate_
void evf::FastMonitoringService::postGlobalBeginRun ( edm::GlobalContext const &  gc)
void evf::FastMonitoringService::postGlobalEndLumi ( edm::GlobalContext const &  gc)

Definition at line 505 of file FastMonitoringService.cc.

References lastGlobalLumisClosed_, edm::LuminosityBlockID::luminosityBlock(), and edm::GlobalContext::luminosityBlockID().

Referenced by FastMonitoringService().

506  {
507  //mark closed lumis (still keep map entries until next one)
508  lastGlobalLumisClosed_.push(gc.luminosityBlockID().luminosityBlock());
509  }
std::queue< unsigned int > lastGlobalLumisClosed_
void evf::FastMonitoringService::postModuleEvent ( edm::StreamContext const &  sc,
edm::ModuleCallingContext const &  mcc 
)

Definition at line 630 of file FastMonitoringService.cc.

References evf::MicroStateService::mFwkOvhMod, microstate_, evf::MicroStateService::reservedMicroStateNames, edm::StreamContext::streamID(), and edm::StreamID::value().

Referenced by FastMonitoringService().

631  {
632  //microstate_[sc.streamID().value()] = (void*)(mcc.moduleDescription());
633  microstate_[sc.streamID().value()] = &reservedMicroStateNames[mFwkOvhMod];
634  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< const void * > microstate_
void evf::FastMonitoringService::postSourceEvent ( edm::StreamID  sid)

Definition at line 620 of file FastMonitoringService.cc.

References evf::MicroStateService::mFwkOvhSrc, microstate_, evf::MicroStateService::reservedMicroStateNames, and edm::StreamID::value().

Referenced by FastMonitoringService().

621  {
623  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< const void * > microstate_
unsigned int value() const
Definition: StreamID.h:46
void evf::FastMonitoringService::postStreamBeginLumi ( edm::StreamContext const &  sc)
void evf::FastMonitoringService::postStreamEndLumi ( edm::StreamContext const &  sc)
void evf::FastMonitoringService::preallocate ( edm::service::SystemBounds const &  bounds)

Definition at line 174 of file FastMonitoringService.cc.

References edm::service::SystemBounds::maxNumberOfStreams(), edm::service::SystemBounds::maxNumberOfThreads(), nStreams_, and nThreads_.

Referenced by FastMonitoringService().

175  {
176  nStreams_=bounds.maxNumberOfStreams();
177  nThreads_=bounds.maxNumberOfThreads();
178  //this should already be >=1
179  if (nStreams_==0) nStreams_=1;
180  if (nThreads_==0) nThreads_=1;
181  }
void evf::FastMonitoringService::preBeginJob ( edm::PathsAndConsumesOfModulesBase const &  ,
edm::ProcessContext const &  pc 
)

Definition at line 183 of file FastMonitoringService.cc.

References collectedPathList_, evf::FastMonitoringService::Encoding::completeReservedWithDummies(), dowork(), emptyLumisectionMode_, encModule_, encPath_, eventCountForPathInit_, Exception, fastMicrostateDefPath_, fastName_, fastPath_, fastPathList_, filePerFwkStream_, firstEventId_, fmt_, i, evf::FastMonitoringThread::inCOUNT, inputLegendFileJson_, evf::FastMonitoringThread::MonitorData::inputstateBins_, isGlobalLumiTransition_, evf::FastMonitoringThread::jsonMonitor_, lastGlobalLumi_, LogDebug, lumiFromSource_, evf::FastMonitoringThread::m_data, macrostate_, evf::FastMonitoringThread::MonitorData::macrostateBins_, evf::FastMonitoringThread::MCOUNT, evf::MicroStateService::mCOUNT, microstate_, evf::FastMonitoringThread::MonitorData::microstateBins_, microstateDefPath_, ministate_, evf::FastMonitoringThread::MonitorData::ministateBins_, evf::MicroStateService::mInvalid, moduleLegendFile_, moduleLegendFileJson_, monInit_, nopath_, nStreams_, nThreads_, cppFunctionSkipper::operator, fed_dqm_sourceclient-live_cfg::path, pathLegendFile_, pathLegendFileJson_, evf::FastMonitoringThread::MonitorData::registerVariables(), evf::MicroStateService::reservedMicroStateNames, evf::FastMonitoringThread::resetFastMonitor(), runDirectory_, evf::FastMonitoringThread::sInit, evf::FastMonitoringThread::start(), streamCounterUpdating_, threadIDAvailable_, evf::FastMonitoringService::Encoding::updateReserved(), and workingDirectory_.

Referenced by FastMonitoringService().

185  {
186 
187  // FIND RUN DIRECTORY
188  // The run dir should be set via the configuration of EvFDaqDirector
189 
190  if (edm::Service<evf::EvFDaqDirector>().operator->()==nullptr)
191  {
192  throw cms::Exception("FastMonitoringService") << "EvFDaqDirector is not present";
193 
194  }
195  emptyLumisectionMode_ = edm::Service<evf::EvFDaqDirector>()->emptyLumisectionMode();
196  boost::filesystem::path runDirectory(edm::Service<evf::EvFDaqDirector>()->baseRunDir());
197  workingDirectory_ = runDirectory_ = runDirectory;
198  workingDirectory_ /= "mon";
199 
200  if ( !boost::filesystem::is_directory(workingDirectory_)) {
201  LogDebug("FastMonitoringService") << "<MON> DIR NOT FOUND! Trying to create -: " << workingDirectory_.string() ;
202  boost::filesystem::create_directories(workingDirectory_);
203  if ( !boost::filesystem::is_directory(workingDirectory_))
204  edm::LogWarning("FastMonitoringService") << "Unable to create <MON> DIR -: " << workingDirectory_.string()
205  << ". No monitoring data will be written.";
206  }
207 
208  std::ostringstream fastFileName;
209 
210  fastFileName << fastName_ << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".fast";
212  fast /= fastFileName.str();
213  fastPath_ = fast.string();
214  if (filePerFwkStream_)
215  for (unsigned int i=0;i<nStreams_;i++) {
216  std::ostringstream fastFileNameTid;
217  fastFileNameTid << fastName_ << "_pid" << std::setfill('0') << std::setw(5) << getpid() << "_tid" << i << ".fast";
219  fastTid /= fastFileNameTid.str();
220  fastPathList_.push_back(fastTid.string());
221  }
222 
223  std::ostringstream moduleLegFile;
224  std::ostringstream moduleLegFileJson;
225  moduleLegFile << "microstatelegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
226  moduleLegFileJson << "microstatelegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
227  moduleLegendFile_ = (workingDirectory_/moduleLegFile.str()).string();
228  moduleLegendFileJson_ = (workingDirectory_/moduleLegFileJson.str()).string();
229 
230  std::ostringstream pathLegFile;
231  std::ostringstream pathLegFileJson;
232  pathLegFile << "pathlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".leg";
233  pathLegendFile_ = (workingDirectory_/pathLegFile.str()).string();
234  pathLegFileJson << "pathlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
235  pathLegendFileJson_ = (workingDirectory_/pathLegFileJson.str()).string();
236 
237  std::ostringstream inputLegFileJson;
238  inputLegFileJson << "inputlegend_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
239  inputLegendFileJson_ = (workingDirectory_/inputLegFileJson.str()).string();
240 
241  LogDebug("FastMonitoringService") << "Initializing FastMonitor with microstate def path -: "
243  //<< encPath_.current_ + 1 << " " << encModule_.current_ + 1
244 
245  /*
246  * initialize the fast monitor with:
247  * vector of pointers to monitorable parameters
248  * path to definition
249  *
250  */
251 
253 
254  for(unsigned int i = 0; i < (mCOUNT); i++)
255  encModule_.updateReserved(static_cast<const void*>(reservedMicroStateNames+i));
257 
258  for (unsigned int i=0;i<nStreams_;i++) {
259  ministate_.push_back(&nopath_);
261 
262  //for synchronization
263  streamCounterUpdating_.push_back(new std::atomic<bool>(0));
264 
265  //path (mini) state
266  encPath_.emplace_back(0);
267  encPath_[i].update(static_cast<const void*>(&nopath_));
268  eventCountForPathInit_.push_back(0);
269  firstEventId_.push_back(0);
270  collectedPathList_.push_back(new std::atomic<bool>(0));
271 
272  }
273  //for (unsigned int i=0;i<nThreads_;i++)
274  // threadMicrostate_.push_back(&reservedMicroStateNames[mInvalid]);
275 
276  //initial size until we detect number of bins
281 
282  lastGlobalLumi_=0;
284  lumiFromSource_=0;
285 
286  //startup monitoring
288  fmt_.jsonMonitor_->setNStreams(nStreams_);
290  monInit_.store(false,std::memory_order_release);
292 
293  //this definition needs: #include "tbb/compat/thread"
294  //however this would results in TBB imeplementation replacing std::thread
295  //(both supposedly call pthread_self())
296  //number of threads created in process could be obtained from /proc,
297  //assuming that all posix threads are true kernel threads capable of running in parallel
298 
299  //#if TBB_IMPLEMENT_CPP0X
301  //threadIDAvailable_=true;
302  //#endif
303 
304  }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
boost::filesystem::path runDirectory_
void start(void(FastMonitoringService::*fp)(), FastMonitoringService *cp)
std::vector< unsigned int > eventCountForPathInit_
std::vector< std::atomic< bool > * > streamCounterUpdating_
void registerVariables(jsoncollector::FastMonitor *fm, unsigned int nStreams, unsigned int nThreads)
std::vector< std::atomic< bool > * > collectedPathList_
std::unique_ptr< jsoncollector::FastMonitor > jsonMonitor_
static const std::string nopath_
void resetFastMonitor(std::string const &microStateDefPath, std::string const &fastMicroStateDefPath)
std::vector< unsigned long > firstEventId_
std::vector< std::string > fastPathList_
std::vector< const void * > microstate_
FastMonitoringThread::Macrostate macrostate_
boost::filesystem::path workingDirectory_
std::vector< const void * > ministate_
std::vector< Encoding > encPath_
void evf::FastMonitoringService::preEvent ( edm::StreamContext const &  sc)

Definition at line 584 of file FastMonitoringService.cc.

Referenced by FastMonitoringService().

585  {
586  }
void evf::FastMonitoringService::preGlobalBeginLumi ( edm::GlobalContext const &  gc)

Definition at line 394 of file FastMonitoringService.cc.

References accuSize_, avgLeadTime_, filesProcessedDuringLumi_, fmt_, isGlobalLumiTransition_, lastGlobalLumi_, lastGlobalLumisClosed_, CommonMethods::lock(), lockStatsDuringLumi_, edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), lumiStartTime_, evf::FastMonitoringThread::monlock_, and processedEventsPerLumi_.

Referenced by FastMonitoringService().

395  {
396  timeval lumiStartTime;
397  gettimeofday(&lumiStartTime, 0);
398  unsigned int newLumi = gc.luminosityBlockID().luminosityBlock();
399 
400  std::lock_guard<std::mutex> lock(fmt_.monlock_);
401 
402  lumiStartTime_[newLumi]=lumiStartTime;
403  while (!lastGlobalLumisClosed_.empty()) {
404  //wipe out old map entries as they aren't needed and slow down access
405  unsigned int oldLumi = lastGlobalLumisClosed_.back();
407  lumiStartTime_.erase(oldLumi);
408  avgLeadTime_.erase(oldLumi);
409  filesProcessedDuringLumi_.erase(oldLumi);
410  accuSize_.erase(oldLumi);
411  lockStatsDuringLumi_.erase(oldLumi);
412  processedEventsPerLumi_.erase(oldLumi);
413  }
414  lastGlobalLumi_= newLumi;
416  }
std::map< unsigned int, timeval > lumiStartTime_
std::map< unsigned int, unsigned long > accuSize_
std::map< unsigned int, unsigned int > filesProcessedDuringLumi_
std::queue< unsigned int > lastGlobalLumisClosed_
std::map< unsigned int, double > avgLeadTime_
std::map< unsigned int, std::pair< double, unsigned int > > lockStatsDuringLumi_
std::map< unsigned int, std::pair< unsigned int, bool > > processedEventsPerLumi_
void evf::FastMonitoringService::preGlobalEarlyTermination ( edm::GlobalContext const &  gc,
edm::TerminationOrigin  to 
)

Definition at line 318 of file FastMonitoringService.cc.

References edm::ExceptionFromAnotherContext, edm::ExceptionFromThisContext, exceptionInLS_, edm::ExternalSignal, fmt_, CommonMethods::lock(), edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), evf::FastMonitoringThread::monlock_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FastMonitoringService().

319  {
320  std::string context;
321  if (to==edm::TerminationOrigin::ExceptionFromThisContext) context = " FromThisContext ";
322  if (to==edm::TerminationOrigin::ExceptionFromAnotherContext) context = " FromAnotherContext";
323  if (to==edm::TerminationOrigin::ExternalSignal) context = " FromExternalSignal";
324  edm::LogWarning("FastMonitoringService") << " GLOBAL " << "earlyTermination -: LS:"
325  << gc.luminosityBlockID().luminosityBlock() << " " << context;
326  std::lock_guard<std::mutex> lock(fmt_.monlock_);
327  exceptionInLS_.push_back(gc.luminosityBlockID().luminosityBlock());
328  }
std::vector< unsigned int > exceptionInLS_
void evf::FastMonitoringService::preGlobalEndLumi ( edm::GlobalContext const &  gc)

Definition at line 418 of file FastMonitoringService.cc.

References accuSize_, doSnapshot(), Exception, exception_detected_, exceptionInLS_, evf::FastMonitoringThread::MonitorData::fastThroughputJ_, filePerFwkStream_, fmt_, FedRawDataInputSource::getEventReport(), inputSource_, isGlobalLumiTransition_, evf::FastMonitoringThread::jsonMonitor_, CommonMethods::lock(), LogDebug, fjr2json::lumi, edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), lumiStartTime_, evf::FastMonitoringThread::m_data, evf::FastMonitoringThread::monlock_, fed_dqm_sourceclient-live_cfg::path, processedEventsPerLumi_, edm::shutdown_flag, slowName_, throughputFactor(), jsoncollector::IntJ::value(), jsoncollector::DoubleJ::value(), and workingDirectory_.

Referenced by FastMonitoringService().

419  {
420  unsigned int lumi = gc.luminosityBlockID().luminosityBlock();
421  LogDebug("FastMonitoringService") << "Lumi ended. Writing JSON information. LUMI -: "
422  << lumi;
423  timeval lumiStopTime;
424  gettimeofday(&lumiStopTime, 0);
425 
426  std::lock_guard<std::mutex> lock(fmt_.monlock_);
427 
428  // Compute throughput
429  timeval stt = lumiStartTime_[lumi];
430  unsigned long usecondsForLumi = (lumiStopTime.tv_sec - stt.tv_sec)*1000000
431  + (lumiStopTime.tv_usec - stt.tv_usec);
432  unsigned long accuSize = accuSize_.find(lumi)==accuSize_.end() ? 0 : accuSize_[lumi];
433  double throughput = throughputFactor()* double(accuSize) / double(usecondsForLumi);
434  //store to registered variable
435  fmt_.m_data.fastThroughputJ_.value() = throughput;
436 
437  //update
438  doSnapshot(lumi,true);
439 
440  //retrieve one result we need (todo: sanity check if it's found)
441  IntJ *lumiProcessedJptr = dynamic_cast<IntJ*>(fmt_.jsonMonitor_->getMergedIntJForLumi("Processed",lumi));
442  if (!lumiProcessedJptr)
443  throw cms::Exception("FastMonitoringService") << "Internal error: got null pointer from FastMonitor";
444  processedEventsPerLumi_[lumi] = std::pair<unsigned int,bool>(lumiProcessedJptr->value(),false);
445 
446  //checking if exception has been thrown (in case of Global/Stream early termination, for this LS)
447  bool exception_detected = exception_detected_;
448  for (auto ex : exceptionInLS_)
449  if (lumi == ex) exception_detected=true;
450 
451  if (edm::shutdown_flag || exception_detected) {
452  edm::LogInfo("FastMonitoringService") << "Run interrupted. Skip writing EoL information -: "
453  << processedEventsPerLumi_[lumi].first << " events were processed in LUMI " << lumi;
454  //this will prevent output modules from producing json file for possibly incomplete lumi
455  processedEventsPerLumi_[lumi].first=0;
456  processedEventsPerLumi_[lumi].second=true;
457  //disable this exception, so service can be used standalone (will be thrown if output module asks for this information)
458  //throw cms::Exception("FastMonitoringService") << "SOURCE did not send update for lumi block. LUMI -:" << lumi;
459  return;
460 
461  }
462 
463  if (inputSource_) {
464  auto sourceReport = inputSource_->getEventReport(lumi, true);
465  if (sourceReport.first) {
466  if (sourceReport.second!=processedEventsPerLumi_[lumi].first) {
467  throw cms::Exception("FastMonitoringService") << "MISMATCH with SOURCE update. LUMI -: "
468  << lumi
469  << ", events(processed):" << processedEventsPerLumi_[lumi].first
470  << " events(source):" << sourceReport.second;
471  }
472  }
473  }
474  edm::LogInfo("FastMonitoringService") << "Statistics for lumisection -: lumi = " << lumi << " events = "
475  << lumiProcessedJptr->value() << " time = " << usecondsForLumi/1000000
476  << " size = " << accuSize << " thr = " << throughput;
477  delete lumiProcessedJptr;
478 
479  //full global and stream merge&output for this lumi
480 
481  // create file name for slow monitoring file
482  if (filePerFwkStream_) {
483  std::stringstream slowFileNameStem;
484  slowFileNameStem << slowName_ << "_ls" << std::setfill('0') << std::setw(4)
485  << lumi << "_pid" << std::setfill('0')
486  << std::setw(5) << getpid();
488  slow /= slowFileNameStem.str();
489  fmt_.jsonMonitor_->outputFullJSONs(slow.string(),".jsn",lumi);
490  }
491  else {
492  std::stringstream slowFileName;
493  slowFileName << slowName_ << "_ls" << std::setfill('0') << std::setw(4)
494  << lumi << "_pid" << std::setfill('0')
495  << std::setw(5) << getpid() << ".jsn";
497  slow /= slowFileName.str();
498  fmt_.jsonMonitor_->outputFullJSON(slow.string(),lumi);//full global and stream merge and JSON write for this lumi
499  }
500  fmt_.jsonMonitor_->discardCollected(lumi);//we don't do further updates for this lumi
501 
503  }
#define LogDebug(id)
std::map< unsigned int, timeval > lumiStartTime_
std::pair< bool, unsigned int > getEventReport(unsigned int lumi, bool erase)
double throughputFactor()
std::map< unsigned int, unsigned long > accuSize_
tuple lumi
Definition: fjr2json.py:35
volatile std::atomic< bool > shutdown_flag
void doSnapshot(const unsigned int ls, const bool isGlobalEOL)
std::unique_ptr< jsoncollector::FastMonitor > jsonMonitor_
std::map< unsigned int, std::pair< unsigned int, bool > > processedEventsPerLumi_
FedRawDataInputSource * inputSource_
boost::filesystem::path workingDirectory_
std::vector< unsigned int > exceptionInLS_
void evf::FastMonitoringService::preModuleBeginJob ( edm::ModuleDescription const &  desc)

Definition at line 352 of file FastMonitoringService.cc.

References encModule_, fmt_, CommonMethods::lock(), edm::ModuleDescription::moduleName(), evf::FastMonitoringThread::monlock_, nOutputModules_, evf::FastMonitoringService::Encoding::update(), and evf::FastMonitoringService::Encoding::updateReserved().

Referenced by FastMonitoringService().

353  {
354  std::lock_guard<std::mutex> lock(fmt_.monlock_);
355  //std::cout << " Pre module Begin Job module: " << desc.moduleName() << std::endl;
356 
357  //build a map of modules keyed by their module description address
358  //here we need to treat output modules in a special way so they can be easily singled out
359  if(desc.moduleName() == "Stream" || desc.moduleName() == "ShmStreamConsumer" || desc.moduleName() == "EvFOutputModule" ||
360  desc.moduleName() == "EventStreamFileWriter" || desc.moduleName() == "PoolOutputModule") {
361  encModule_.updateReserved((void*)&desc);
362  nOutputModules_++;
363  }
364  else
365  encModule_.update((void*)&desc);
366  }
void evf::FastMonitoringService::preModuleEvent ( edm::StreamContext const &  sc,
edm::ModuleCallingContext const &  mcc 
)

Definition at line 625 of file FastMonitoringService.cc.

References microstate_, edm::ModuleCallingContext::moduleDescription(), edm::StreamContext::streamID(), and edm::StreamID::value().

Referenced by FastMonitoringService().

626  {
627  microstate_[sc.streamID().value()] = (void*)(mcc.moduleDescription());
628  }
std::vector< const void * > microstate_
void evf::FastMonitoringService::prePathEvent ( edm::StreamContext const &  sc,
edm::PathContext const &  pc 
)

Definition at line 551 of file FastMonitoringService.cc.

References collectedPathList_, encPath_, edm::EventID::event(), eventCountForPathInit_, edm::StreamContext::eventID(), firstEventId_, fmt_, CommonMethods::lock(), evf::FastMonitoringThread::m_data, makePathLegendaJson(), ministate_, evf::FastMonitoringThread::MonitorData::ministateBins_, evf::FastMonitoringThread::monlock_, pathLegendFileJson_, pathLegendWritten_, edm::PathContext::pathName(), edm::StreamContext::streamID(), AlCaHLTBitMon_QueryRunRegistry::string, and unlikely.

Referenced by FastMonitoringService().

552  {
553  //make sure that all path names are retrieved before allowing ministate to change
554  //hack: assume memory is synchronized after ~50 events seen by each stream
555  if (unlikely(eventCountForPathInit_[sc.streamID()]<50) && false==collectedPathList_[sc.streamID()]->load(std::memory_order_acquire))
556  {
557  //protection between stream threads, as well as the service monitoring thread
558  std::lock_guard<std::mutex> lock(fmt_.monlock_);
559 
560  if (firstEventId_[sc.streamID()]==0)
561  firstEventId_[sc.streamID()]=sc.eventID().event();
562  if (sc.eventID().event()==firstEventId_[sc.streamID()])
563  {
564  encPath_[sc.streamID()].update((void*)&pc.pathName());
565  return;
566  }
567  else {
568  //finished collecting path names
569  collectedPathList_[sc.streamID()]->store(true,std::memory_order_seq_cst);
570  fmt_.m_data.ministateBins_=encPath_[sc.streamID()].vecsize();
571  if (!pathLegendWritten_) {
572  std::string pathLegendStrJson = makePathLegendaJson();
573  FileIO::writeStringToFile(pathLegendFileJson_, pathLegendStrJson);
574  pathLegendWritten_=true;
575  }
576  }
577  }
578  else {
579  ministate_[sc.streamID()] = &(pc.pathName());
580  }
581  }
std::vector< unsigned int > eventCountForPathInit_
#define unlikely(x)
std::vector< std::atomic< bool > * > collectedPathList_
std::vector< unsigned long > firstEventId_
std::vector< const void * > ministate_
std::vector< Encoding > encPath_
void evf::FastMonitoringService::preSourceEarlyTermination ( edm::TerminationOrigin  to)
void evf::FastMonitoringService::preSourceEvent ( edm::StreamID  sid)

Definition at line 615 of file FastMonitoringService.cc.

References microstate_, evf::MicroStateService::mInput, evf::MicroStateService::reservedMicroStateNames, and edm::StreamID::value().

Referenced by FastMonitoringService().

616  {
618  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< const void * > microstate_
unsigned int value() const
Definition: StreamID.h:46
void evf::FastMonitoringService::preStreamBeginLumi ( edm::StreamContext const &  sc)

Definition at line 511 of file FastMonitoringService.cc.

References edm::StreamContext::eventID(), fmt_, CommonMethods::lock(), edm::EventID::luminosityBlock(), evf::FastMonitoringThread::m_data, evf::MicroStateService::mBoL, microstate_, ministate_, evf::FastMonitoringThread::monlock_, nopath_, evf::FastMonitoringThread::MonitorData::processed_, evf::MicroStateService::reservedMicroStateNames, edm::StreamContext::streamID(), evf::FastMonitoringThread::MonitorData::streamLumi_, and edm::StreamID::value().

Referenced by FastMonitoringService().

512  {
513  unsigned int sid = sc.streamID().value();
514  std::lock_guard<std::mutex> lock(fmt_.monlock_);
515  fmt_.m_data.streamLumi_[sid] = sc.eventID().luminosityBlock();
516 
517  //reset collected values for this stream
518  *(fmt_.m_data.processed_[sid])=0;
519 
520  ministate_[sid]=&nopath_;
522  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
static const std::string nopath_
std::vector< const void * > microstate_
std::vector< jsoncollector::AtomicMonUInt * > processed_
std::vector< const void * > ministate_
std::vector< unsigned int > streamLumi_
void evf::FastMonitoringService::preStreamEarlyTermination ( edm::StreamContext const &  sc,
edm::TerminationOrigin  to 
)

Definition at line 306 of file FastMonitoringService.cc.

References edm::StreamContext::eventID(), edm::ExceptionFromAnotherContext, edm::ExceptionFromThisContext, exceptionInLS_, edm::ExternalSignal, fmt_, CommonMethods::lock(), edm::EventID::luminosityBlock(), evf::FastMonitoringThread::monlock_, edm::StreamContext::streamID(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::StreamID::value().

Referenced by FastMonitoringService().

307  {
308  std::string context;
309  if (to==edm::TerminationOrigin::ExceptionFromThisContext) context = " FromThisContext ";
310  if (to==edm::TerminationOrigin::ExceptionFromAnotherContext) context = " FromAnotherContext";
311  if (to==edm::TerminationOrigin::ExternalSignal) context = " FromExternalSignal";
312  edm::LogWarning("FastMonitoringService") << " STREAM " << sc.streamID().value() << " earlyTermination -: ID:"<< sc.eventID()
313  << " LS:" << sc.eventID().luminosityBlock() << " " << context;
314  std::lock_guard<std::mutex> lock(fmt_.monlock_);
315  exceptionInLS_.push_back(sc.eventID().luminosityBlock());
316  }
std::vector< unsigned int > exceptionInLS_
void evf::FastMonitoringService::preStreamEndLumi ( edm::StreamContext const &  sc)

Definition at line 529 of file FastMonitoringService.cc.

References doStreamEOLSnapshot(), edm::StreamContext::eventID(), fmt_, svgfig::load(), CommonMethods::lock(), edm::EventID::luminosityBlock(), evf::MicroStateService::mEoL, microstate_, ministate_, evf::FastMonitoringThread::monlock_, nopath_, evf::MicroStateService::reservedMicroStateNames, streamCounterUpdating_, edm::StreamContext::streamID(), and edm::StreamID::value().

Referenced by FastMonitoringService().

530  {
531  unsigned int sid = sc.streamID().value();
532  std::lock_guard<std::mutex> lock(fmt_.monlock_);
533 
534  #if ATOMIC_LEVEL>=2
535  //spinlock to make sure we are not still updating event counter somewhere
536  while (streamCounterUpdating_[sid]->load(std::memory_order_acquire)) {}
537  #endif
538 
539  //update processed count to be complete at this time
540  doStreamEOLSnapshot(sc.eventID().luminosityBlock(),sid);
541  //reset this in case stream does not get notified of next lumi (we keep processed events only)
542  ministate_[sid]=&nopath_;
544  }
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< std::atomic< bool > * > streamCounterUpdating_
void doStreamEOLSnapshot(const unsigned int ls, const unsigned int streamID)
static const std::string nopath_
def load
Definition: svgfig.py:546
std::vector< const void * > microstate_
std::vector< const void * > ministate_
void evf::FastMonitoringService::reportLockWait ( unsigned int  ls,
double  waitTime,
unsigned int  lockCount 
)

Definition at line 699 of file FastMonitoringService.cc.

References fmt_, CommonMethods::lock(), lockStatsDuringLumi_, eostools::ls(), and evf::FastMonitoringThread::monlock_.

Referenced by FedRawDataInputSource::readSupervisor().

700  {
701  std::lock_guard<std::mutex> lock(fmt_.monlock_);
702  lockStatsDuringLumi_[ls]=std::pair<double,unsigned int>(waitTime,lockCount);
703 
704  }
def ls
Definition: eostools.py:348
std::map< unsigned int, std::pair< double, unsigned int > > lockStatsDuringLumi_
void evf::FastMonitoringService::setExceptionDetected ( unsigned int  ls)

Definition at line 341 of file FastMonitoringService.cc.

References exception_detected_, and exceptionInLS_.

Referenced by FedRawDataInputSource::getNextEvent().

341  {
342  if (!ls) exception_detected_=true;
343  else exceptionInLS_.push_back(ls);
344  }
def ls
Definition: eostools.py:348
std::vector< unsigned int > exceptionInLS_
void evf::FastMonitoringService::setInputSource ( FedRawDataInputSource inputSource)
inline

Definition at line 173 of file FastMonitoringService.h.

References inputSource_.

Referenced by FedRawDataInputSource::FedRawDataInputSource().

173 {inputSource_=inputSource;}
FedRawDataInputSource * inputSource_
void evf::FastMonitoringService::setInState ( FastMonitoringThread::InputState  inputState)
inline
void evf::FastMonitoringService::setInStateSup ( FastMonitoringThread::InputState  inputState)
inline

Definition at line 175 of file FastMonitoringService.h.

References inputSupervisorState_.

Referenced by FedRawDataInputSource::FedRawDataInputSource(), and FedRawDataInputSource::readSupervisor().

175 {inputSupervisorState_=inputState;}
FastMonitoringThread::InputState inputSupervisorState_
void evf::FastMonitoringService::setMicroState ( MicroStateService::Microstate  m)
virtual

Implements evf::MicroStateService.

Definition at line 640 of file FastMonitoringService.cc.

References i, microstate_, nStreams_, and evf::MicroStateService::reservedMicroStateNames.

641  {
642  for (unsigned int i=0;i<nStreams_;i++)
644  }
int i
Definition: DBlmapReader.cc:9
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::vector< const void * > microstate_
void evf::FastMonitoringService::setMicroState ( edm::StreamID  sid,
MicroStateService::Microstate  m 
)
virtual
bool evf::FastMonitoringService::shouldWriteFiles ( unsigned int  lumi,
unsigned int *  proc = 0 
)
inline
void evf::FastMonitoringService::startedLookingForFile ( )

Definition at line 665 of file FastMonitoringService.cc.

References fileLookStart_.

Referenced by FedRawDataInputSource::readSupervisor().

665  {
666  gettimeofday(&fileLookStart_, 0);
667  /*
668  std::cout << "Started looking for .raw file at: s=" << fileLookStart_.tv_sec << ": ms = "
669  << fileLookStart_.tv_usec / 1000.0 << std::endl;
670  */
671  }
void evf::FastMonitoringService::stoppedLookingForFile ( unsigned int  lumi)

Definition at line 673 of file FastMonitoringService.cc.

References avgLeadTime_, fileLookStart_, fileLookStop_, fmt_, i, leadTimes_, CommonMethods::lock(), fjr2json::lumi, lumiFromSource_, and evf::FastMonitoringThread::monlock_.

Referenced by FedRawDataInputSource::readSupervisor().

673  {
674  gettimeofday(&fileLookStop_, 0);
675  /*
676  std::cout << "Stopped looking for .raw file at: s=" << fileLookStop_.tv_sec << ": ms = "
677  << fileLookStop_.tv_usec / 1000.0 << std::endl;
678  */
679  std::lock_guard<std::mutex> lock(fmt_.monlock_);
680 
681  if (lumi>lumiFromSource_) {
683  leadTimes_.clear();
684  }
685  unsigned long elapsedTime = (fileLookStop_.tv_sec - fileLookStart_.tv_sec) * 1000000 // sec to us
686  + (fileLookStop_.tv_usec - fileLookStart_.tv_usec); // us
687  // add this to lead times for this lumi
688  leadTimes_.push_back((double)elapsedTime);
689 
690  // recompute average lead time for this lumi
691  if (leadTimes_.size() == 1) avgLeadTime_[lumi] = leadTimes_[0];
692  else {
693  double totTime = 0;
694  for (unsigned int i = 0; i < leadTimes_.size(); i++) totTime += leadTimes_[i];
695  avgLeadTime_[lumi] = 0.001*(totTime / leadTimes_.size());
696  }
697  }
int i
Definition: DBlmapReader.cc:9
tuple lumi
Definition: fjr2json.py:35
std::map< unsigned int, double > avgLeadTime_
std::vector< double > leadTimes_

Member Data Documentation

std::map<unsigned int, unsigned long> evf::FastMonitoringService::accuSize_
private
std::map<unsigned int, double> evf::FastMonitoringService::avgLeadTime_
private

Definition at line 266 of file FastMonitoringService.h.

Referenced by doSnapshot(), preGlobalBeginLumi(), and stoppedLookingForFile().

std::vector<std::atomic<bool>*> evf::FastMonitoringService::collectedPathList_
private

Definition at line 281 of file FastMonitoringService.h.

Referenced by preBeginJob(), and prePathEvent().

bool evf::FastMonitoringService::emptyLumisectionMode_ = false
private

Definition at line 302 of file FastMonitoringService.h.

Referenced by preBeginJob(), and shouldWriteFiles().

Encoding evf::FastMonitoringService::encModule_
private
std::vector<Encoding> evf::FastMonitoringService::encPath_
private
std::vector<unsigned int> evf::FastMonitoringService::eventCountForPathInit_
private

Definition at line 282 of file FastMonitoringService.h.

Referenced by postEvent(), preBeginJob(), and prePathEvent().

bool evf::FastMonitoringService::exception_detected_ = false
private
std::vector<unsigned int> evf::FastMonitoringService::exceptionInLS_
private
std::string evf::FastMonitoringService::fastMicrostateDefPath_
private

Definition at line 242 of file FastMonitoringService.h.

Referenced by FastMonitoringService(), and preBeginJob().

unsigned int evf::FastMonitoringService::fastMonIntervals_
private

Definition at line 240 of file FastMonitoringService.h.

Referenced by dowork().

std::string evf::FastMonitoringService::fastName_
private

Definition at line 243 of file FastMonitoringService.h.

Referenced by preBeginJob().

std::string evf::FastMonitoringService::fastPath_
private

Definition at line 243 of file FastMonitoringService.h.

Referenced by dowork(), and preBeginJob().

std::vector<std::string> evf::FastMonitoringService::fastPathList_
private

Definition at line 303 of file FastMonitoringService.h.

Referenced by dowork(), and preBeginJob().

timeval evf::FastMonitoringService::fileLookStart_
private

Definition at line 249 of file FastMonitoringService.h.

Referenced by startedLookingForFile(), and stoppedLookingForFile().

timeval evf::FastMonitoringService::fileLookStop_
private

Definition at line 249 of file FastMonitoringService.h.

Referenced by stoppedLookingForFile().

bool evf::FastMonitoringService::filePerFwkStream_
private

Definition at line 244 of file FastMonitoringService.h.

Referenced by dowork(), preBeginJob(), and preGlobalEndLumi().

std::map<unsigned int, unsigned int> evf::FastMonitoringService::filesProcessedDuringLumi_
private

Definition at line 267 of file FastMonitoringService.h.

Referenced by accumulateFileSize(), doSnapshot(), and preGlobalBeginLumi().

std::vector<unsigned long> evf::FastMonitoringService::firstEventId_
private

Definition at line 280 of file FastMonitoringService.h.

Referenced by preBeginJob(), and prePathEvent().

FastMonitoringThread evf::FastMonitoringService::fmt_
private
std::string evf::FastMonitoringService::inputLegendFileJson_
private

Definition at line 295 of file FastMonitoringService.h.

Referenced by postBeginJob(), and preBeginJob().

FedRawDataInputSource* evf::FastMonitoringService::inputSource_ = 0
private

Definition at line 233 of file FastMonitoringService.h.

Referenced by preGlobalEndLumi(), and setInputSource().

FastMonitoringThread::InputState evf::FastMonitoringService::inputState_
private

Definition at line 234 of file FastMonitoringService.h.

Referenced by doSnapshot(), dowork(), and setInState().

const std::string evf::FastMonitoringService::inputStateNames
static
Initial value:
=
{"Ignore","Init","WaitInput","NewLumi","RunEnd","ProcessingFile","WaitChunk","ChunkReceived",
"ChecksumEvent","CachedEvent","ReadEvent","ReadCleanup","NoRequest","NoRequestWithIdleThreads",
"NoRequestWithIdleAndEoLThreads","NoRequestWithGlobalEoL","NoRequestWithAllEoLThreads","NoRequestWithEoLThreads",
"SupFileLimit", "SupWaitFreeChunk","SupWaitFreeChunkCopying", "SupWaitFreeThread","SupWaitFreeThreadCopying",
"SupBusy", "SupLockPolling","SupLockPollingCopying",
"SupNoFile", "SupNewFile", "SupNewFileWaitThreadCopying", "SupNewFileWaitThread",
"SupNewFileWaitChunkCopying", "SupNewFileWaitChunk",
"WaitInput_fileLimit","WaitInput_waitFreeChunk","WaitInput_waitFreeChunkCopying","WaitInput_waitFreeThread","WaitInput_waitFreeThreadCopying",
"WaitInput_busy","WaitInput_lockPolling","WaitInput_lockPollingCopying","WaitInput_runEnd",
"WaitInput_noFile","WaitInput_newFile","WaitInput_newFileWaitThreadCopying","WaitInput_newFileWaitThread",
"WaitInput_newFileWaitChunkCopying","WaitInput_newFileWaitChunk",
"WaitChunk_fileLimit","WaitChunk_waitFreeChunk","WaitChunk_waitFreeChunkCopying","WaitChunk_waitFreeThread","WaitChunk_waitFreeThreadCopying",
"WaitChunk_busy","WaitChunk_lockPolling","WaitChunk_lockPollingCopying","WaitChunk_runEnd",
"WaitChunk_noFile","WaitChunk_newFile","WaitChunk_newFileWaitThreadCopying","WaitChunk_newFileWaitThread",
"WaitChunk_newFileWaitChunkCopying","WaitChunk_newFileWaitChunk"
}

Definition at line 115 of file FastMonitoringService.h.

Referenced by dowork(), and makeInputLegendaJson().

FastMonitoringThread::InputState evf::FastMonitoringService::inputSupervisorState_
private

Definition at line 235 of file FastMonitoringService.h.

Referenced by doSnapshot(), dowork(), and setInStateSup().

bool evf::FastMonitoringService::isGlobalLumiTransition_
private
unsigned int evf::FastMonitoringService::lastGlobalLumi_
private

Definition at line 251 of file FastMonitoringService.h.

Referenced by dowork(), preBeginJob(), and preGlobalBeginLumi().

std::queue<unsigned int> evf::FastMonitoringService::lastGlobalLumisClosed_
private

Definition at line 252 of file FastMonitoringService.h.

Referenced by postGlobalEndLumi(), and preGlobalBeginLumi().

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

Definition at line 270 of file FastMonitoringService.h.

Referenced by stoppedLookingForFile().

std::map<unsigned int, std::pair<double,unsigned int> > evf::FastMonitoringService::lockStatsDuringLumi_
private

Definition at line 271 of file FastMonitoringService.h.

Referenced by doSnapshot(), preGlobalBeginLumi(), and reportLockWait().

unsigned int evf::FastMonitoringService::lumiFromSource_
private

Definition at line 254 of file FastMonitoringService.h.

Referenced by preBeginJob(), and stoppedLookingForFile().

std::map<unsigned int, timeval> evf::FastMonitoringService::lumiStartTime_
private

Definition at line 248 of file FastMonitoringService.h.

Referenced by preGlobalBeginLumi(), and preGlobalEndLumi().

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

Definition at line 114 of file FastMonitoringService.h.

std::vector<const void*> evf::FastMonitoringService::microstate_
private
std::string evf::FastMonitoringService::microstateDefPath_
private

Definition at line 242 of file FastMonitoringService.h.

Referenced by FastMonitoringService(), and preBeginJob().

std::vector<const void*> evf::FastMonitoringService::ministate_
private
std::string evf::FastMonitoringService::moduleLegendFile_
private

Definition at line 291 of file FastMonitoringService.h.

Referenced by preBeginJob().

std::string evf::FastMonitoringService::moduleLegendFileJson_
private

Definition at line 292 of file FastMonitoringService.h.

Referenced by postBeginJob(), and preBeginJob().

std::atomic<bool> evf::FastMonitoringService::monInit_
private

Definition at line 299 of file FastMonitoringService.h.

Referenced by dowork(), and preBeginJob().

const std::string evf::FastMonitoringService::nopath_ = "NoPath"
static
unsigned int evf::FastMonitoringService::nOutputModules_ =0
private

Definition at line 297 of file FastMonitoringService.h.

Referenced by makeModuleLegendaJson(), and preModuleBeginJob().

unsigned int evf::FastMonitoringService::nStreams_
private

Definition at line 237 of file FastMonitoringService.h.

Referenced by doSnapshot(), dowork(), preallocate(), preBeginJob(), and setMicroState().

unsigned int evf::FastMonitoringService::nThreads_
private

Definition at line 238 of file FastMonitoringService.h.

Referenced by preallocate(), and preBeginJob().

std::string evf::FastMonitoringService::pathLegendFile_
private

Definition at line 293 of file FastMonitoringService.h.

Referenced by preBeginJob().

std::string evf::FastMonitoringService::pathLegendFileJson_
private

Definition at line 294 of file FastMonitoringService.h.

Referenced by preBeginJob(), and prePathEvent().

bool evf::FastMonitoringService::pathLegendWritten_ = false
private

Definition at line 296 of file FastMonitoringService.h.

Referenced by prePathEvent().

std::vector<bool> evf::FastMonitoringService::pathNamesReady_
private

Definition at line 283 of file FastMonitoringService.h.

std::map<unsigned int, std::pair<unsigned int,bool> > evf::FastMonitoringService::processedEventsPerLumi_
private
boost::filesystem::path evf::FastMonitoringService::runDirectory_
private

Definition at line 285 of file FastMonitoringService.h.

Referenced by getRunDirName(), and preBeginJob().

int evf::FastMonitoringService::sleepTime_
private

Definition at line 239 of file FastMonitoringService.h.

Referenced by dowork().

std::string evf::FastMonitoringService::slowName_
private

Definition at line 243 of file FastMonitoringService.h.

Referenced by preGlobalEndLumi().

unsigned int evf::FastMonitoringService::snapCounter_ = 0
private

Definition at line 241 of file FastMonitoringService.h.

Referenced by dowork().

std::vector<std::atomic<bool>*> evf::FastMonitoringService::streamCounterUpdating_
private

Definition at line 278 of file FastMonitoringService.h.

Referenced by postEvent(), preBeginJob(), and preStreamEndLumi().

bool evf::FastMonitoringService::threadIDAvailable_ = false
private

Definition at line 287 of file FastMonitoringService.h.

Referenced by preBeginJob().

std::vector<const void*> evf::FastMonitoringService::threadMicrostate_
private

Definition at line 262 of file FastMonitoringService.h.

std::atomic<unsigned long> evf::FastMonitoringService::totalEventsProcessed_
private

Definition at line 289 of file FastMonitoringService.h.

Referenced by postEvent().

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

Definition at line 285 of file FastMonitoringService.h.

Referenced by preBeginJob(), and preGlobalEndLumi().