26 {
"Init",
"JobReady",
"RunGiven",
"Running",
27 "Stopping",
"Done",
"JobEnded",
"Error",
"ErrorEnded",
"End",
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)
82 std::ostringstream ost;
93 std::ostringstream ost;
108 throw cms::Exception(
"FastMonitoringService") <<
"EvFDaqDirector is not present";
120 <<
". No monitoring data will be written.";
123 std::ostringstream fastFileName;
125 fastFileName <<
fastName_ <<
"_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".fast";
127 fast /= fastFileName.str();
130 std::ostringstream moduleLegFile;
131 moduleLegFile <<
"microstatelegend_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".leg";
134 std::ostringstream pathLegFile;
135 pathLegFile <<
"pathlegend_pid" << std::setfill(
'0') << std::setw(5) << getpid() <<
".leg";
138 LogDebug(
"FastMonitoringService") <<
"Initializing FastMonitor with microstate def path -: "
158 for(
unsigned int i = 0;
i < (
mCOUNT);
i++)
193 monInit_.store(
false,std::memory_order_release);
255 timeval lumiStartTime;
256 gettimeofday(&lumiStartTime, 0);
279 LogDebug(
"FastMonitoringService") <<
"Lumi ended. Writing JSON information. LUMI -: "
281 timeval lumiStopTime;
282 gettimeofday(&lumiStopTime, 0);
288 unsigned long usecondsForLumi = (lumiStopTime.tv_sec - stt.tv_sec)*1000000
289 + (lumiStopTime.tv_usec - stt.tv_usec);
291 double throughput =
throughputFactor()* double(accuSize) / double(usecondsForLumi);
299 std::stringstream slowFileName;
300 slowFileName <<
slowName_ <<
"_ls" << std::setfill(
'0') << std::setw(4)
301 << lumi <<
"_pid" << std::setfill(
'0')
302 << std::setw(5) << getpid() <<
".jsn";
304 slow /= slowFileName.str();
308 if (!lumiProcessedJptr)
309 throw cms::Exception(
"FastMonitoringService") <<
"Internal error: got null pointer from FastMonitor";
317 edm::LogInfo(
"FastMonitoringService") <<
"Run interrupted. Skip writing EoL information -: "
328 throw cms::Exception(
"FastMonitoringService") <<
"MISMATCH with SOURCE update. LUMI -: "
331 <<
" events(source):" << itr->second;
336 edm::LogInfo(
"FastMonitoringService") <<
"Statistics for lumisection -: lumi = " << lumi <<
" events = "
337 << lumiProcessedJptr->
value() <<
" time = " << usecondsForLumi/1000000
338 <<
" size = " << accuSize <<
" thr = " << throughput;
339 delete lumiProcessedJptr;
443 #elif ATOMIC_LEVEL==1
447 #elif ATOMIC_LEVEL==0 //default
548 unsigned int proc = it->second;
552 throw cms::Exception(
"FastMonitoringService") <<
"output module wants already deleted (or never reported by SOURCE) lumisection event count for LUMI -: "<<
lumi;
int encode(const void *add)
void prePathEvent(edm::StreamContext const &, edm::PathContext const &)
std::string const & pathName() const
unsigned int maxNumberOfThreads() const
EventNumber_t event() const
void watchPreEvent(PreEvent::slot_type const &iSlot)
static const edm::ModuleDescription reservedMicroStateNames[mCOUNT]
std::string pathLegendFile_
void postSourceEvent(edm::StreamID)
std::vector< AtomicMonUInt * > processed_
void watchPrePathEvent(PrePathEvent::slot_type const &iSlot)
void watchPreallocate(Preallocate::slot_type const &iSlot)
void startedLookingForFile()
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
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_
FastMonitoringThread fmt_
unsigned int microstateBins_
std::vector< unsigned int > eventCountForPathInit_
std::vector< std::atomic< bool > * > streamCounterUpdating_
void watchPostEvent(PostEvent::slot_type const &iSlot)
LuminosityBlockID const & luminosityBlockID() const
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 &)
unsigned int lastGlobalLumi_
LuminosityBlockNumber_t luminosityBlock() const
void watchPreStreamEndLumi(PreStreamEndLumi::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)
std::atomic< bool > monInit_
unsigned int maxNumberOfStreams() const
unsigned int getEventsProcessedForLumi(unsigned int lumi)
void preModuleBeginJob(edm::ModuleDescription const &)
void updateReserved(void *add)
unsigned int lumiFromSource_
std::vector< std::atomic< bool > * > collectedPathList_
tuple path
else: Piece not in the list, fine.
std::queue< unsigned int > lastGlobalLumisClosed_
std::string microstateDefPath_
void preStreamEndLumi(edm::StreamContext const &)
std::map< unsigned int, double > avgLeadTime_
std::string moduleLegendFile_
void watchPostStreamBeginLumi(PostStreamBeginLumi::slot_type const &iSlot)
void doSnapshot(const unsigned int ls, const bool isGlobalEOL)
static const std::string nopath_
ModuleDescription const * moduleDescription() const
void resetFastMonitor(std::string const µStateDefPath, std::string const &fastMicroStateDefPath)
bool decode(bool &, std::string const &)
std::string fastMicrostateDefPath_
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
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 &)
void completeReservedWithDummies()
StreamID const & streamID() const
void preSourceEvent(edm::StreamID)
DoubleJ fastAvgLeadTimeJ_
void postStreamEndLumi(edm::StreamContext const &)
std::vector< const void * > microstate_
std::vector< unsigned int > microstateEncoded_
unsigned int value() const
void preStreamBeginLumi(edm::StreamContext const &)
void registerVariables(FastMonitor *fm, unsigned int nStreams, unsigned int nThreads)
std::atomic< unsigned long > totalEventsProcessed_
IntJ fastFilesProcessedJ_
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)
std::string makePathLegenda()
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 &)
bool isGlobalLumiTransition_
EventID const & eventID() const
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
std::vector< const void * > ministate_
unsigned int macrostateBins_
const void * decode(unsigned int index)
std::vector< unsigned int > streamLumi_
unsigned int ministateBins_
std::vector< Encoding > encPath_
std::vector< unsigned int > ministateEncoded_
FastMonitoringService(const edm::ParameterSet &, edm::ActivityRegistry &)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
std::string makeModuleLegenda()