00001 #include "iDie.h"
00002
00003 #include "xdaq/NamespaceURI.h"
00004
00005 #include "xdata/InfoSpaceFactory.h"
00006 #include "toolbox/task/TimerFactory.h"
00007
00008 #include "xoap/SOAPEnvelope.h"
00009 #include "xoap/SOAPBody.h"
00010 #include "xoap/domutils.h"
00011
00012 #include <boost/tokenizer.hpp>
00013
00014 #include <netinet/in.h>
00015 #include <sstream>
00016 #include <errno.h>
00017 #include <iomanip>
00018 #include <algorithm>
00019
00020 #include <sys/time.h>
00021 #include <sys/types.h>
00022 #include <sys/stat.h>
00023
00024 #include <time.h>
00025 #include <math.h>
00026
00027 #include "cgicc/CgiDefs.h"
00028 #include "cgicc/Cgicc.h"
00029 #include "cgicc/FormEntry.h"
00030 #include "cgicc/FormFile.h"
00031 #include "cgicc/HTMLClasses.h"
00032
00033 #include "EventFilter/Utilities/interface/DebugUtils.h"
00034
00035
00036
00037 #include "FWCore/PluginManager/interface/PluginManager.h"
00038 #include "FWCore/PluginManager/interface/PresenceFactory.h"
00039 #include "FWCore/PluginManager/interface/standard.h"
00040 #include "EventFilter/Utilities/interface/ParameterSetRetriever.h"
00041 #include "FWCore/PythonParameterSet/interface/PythonProcessDesc.h"
00042 #include "FWCore/ParameterSet/interface/ProcessDesc.h"
00043 #include "FWCore/ServiceRegistry/interface/Service.h"
00044
00045 #include "DQMServices/Core/src/DQMService.h"
00046 using namespace evf;
00047
00048 #define ROLL 20
00049 #define PASTUPDATES 4
00050
00052
00054
00055
00056 iDie::iDie(xdaq::ApplicationStub *s)
00057 : xdaq::Application(s)
00058 , log_(getApplicationLogger())
00059 , dqmState_("Null")
00060 , instance_(0)
00061 , runNumber_(0)
00062 , lastRunNumberSet_(0)
00063 , runActive_(false)
00064 , runTS_(0)
00065 , latencyTS_(0)
00066 , dqmCollectorHost_()
00067 , dqmCollectorPort_()
00068 , totalCores_(0)
00069 , nstates_(0)
00070 , cpustat_(std::vector<std::vector<int> >(0))
00071 , last_ls_(0)
00072 , f_(0)
00073 , t_(0)
00074 , b_(0)
00075 , b1_(0)
00076 , b2_(0)
00077 , b3_(0)
00078 , b4_(0)
00079 , datap_(0)
00080 , trppriv_(0)
00081 , nModuleLegendaMessageReceived_(0)
00082 , nPathLegendaMessageReceived_(0)
00083 , nModuleLegendaMessageWithDataReceived_(0)
00084 , nPathLegendaMessageWithDataReceived_(0)
00085 , nModuleHistoMessageReceived_(0)
00086 , nPathHistoMessageReceived_(0)
00087 , nDatasetLegendaMessageReceived_(0)
00088 , nDatasetLegendaMessageWithDataReceived_(0)
00089 , evtProcessor_(0)
00090 , meInitialized_(false)
00091 , meInitializedStreams_(false)
00092 , meInitializedDatasets_(false)
00093 , dqmService_(nullptr)
00094 , dqmStore_(nullptr)
00095 , dqmEnabled_(false)
00096 , debugMode_(false)
00097 , saveLsInterval_(10)
00098 , ilumiprev_(0)
00099 , dqmSaveDir_("")
00100 , dqmFilesWritable_(true)
00101 , topLevelFolder_("DAQ")
00102 , savedForLs_(0)
00103 , reportingStart_(0)
00104 , dsMismatch(0)
00105 {
00106
00107 url_ =
00108 getApplicationDescriptor()->getContextDescriptor()->getURL()+"/"+
00109 getApplicationDescriptor()->getURN();
00110 class_ =getApplicationDescriptor()->getClassName();
00111 instance_=getApplicationDescriptor()->getInstance();
00112 hostname_=getApplicationDescriptor()->getContextDescriptor()->getURL();
00113 getApplicationDescriptor()->setAttribute("icon", "/evf/images/idieapp.jpg");
00114
00115
00116 xoap::bind(this,&evf::iDie::fsmCallback,"Configure",XDAQ_NS_URI);
00117 xoap::bind(this,&evf::iDie::fsmCallback,"Enable", XDAQ_NS_URI);
00118 xoap::bind(this,&evf::iDie::fsmCallback,"Stop", XDAQ_NS_URI);
00119 xoap::bind(this,&evf::iDie::fsmCallback,"Halt", XDAQ_NS_URI);
00120
00121
00122 xgi::bind(this,&evf::iDie::defaultWeb, "Default");
00123 xgi::bind(this,&evf::iDie::summaryTable, "summary");
00124 xgi::bind(this,&evf::iDie::detailsTable, "details");
00125 xgi::bind(this,&evf::iDie::dumpTable, "dump" );
00126 xgi::bind(this,&evf::iDie::updater, "updater");
00127 xgi::bind(this,&evf::iDie::iChoke, "iChoke" );
00128 xgi::bind(this,&evf::iDie::iChokeMiniInterface, "iChokeMiniInterface" );
00129 xgi::bind(this,&evf::iDie::spotlight, "Spotlight" );
00130 xgi::bind(this,&evf::iDie::postEntry, "postEntry");
00131 xgi::bind(this,&evf::iDie::postEntryiChoke, "postChoke");
00132
00133
00134
00135 xdata::InfoSpace *ispace = getApplicationInfoSpace();
00136 ispace->fireItemAvailable("runNumber", &runNumber_ );
00137 getApplicationInfoSpace()->addItemChangedListener("runNumber", this);
00138 ispace->fireItemAvailable("dqmCollectorHost", &dqmCollectorHost_ );
00139 ispace->fireItemAvailable("dqmCollectorPort", &dqmCollectorPort_ );
00140 ispace->fireItemAvailable("saveLsInterval", &saveLsInterval_ );
00141 ispace->fireItemAvailable("dqmSaveDir", &dqmSaveDir_ );
00142 ispace->fireItemAvailable("dqmFilesWritableByAll", &dqmFilesWritable_ );
00143 ispace->fireItemAvailable("dqmTopLevelFolder", &topLevelFolder_ );
00144 ispace->fireItemAvailable("dqmEnabled", &dqmEnabled_ );
00145 ispace->fireItemAvailable("debugMode", &debugMode_ );
00146
00147
00148 lastModuleLegendaMessageTimeStamp_.tv_sec=0;
00149 lastModuleLegendaMessageTimeStamp_.tv_usec=0;
00150 lastPathLegendaMessageTimeStamp_.tv_sec=0;
00151 lastPathLegendaMessageTimeStamp_.tv_usec=0;
00152 lastDatasetLegendaMessageTimeStamp_.tv_sec=0;
00153 lastDatasetLegendaMessageTimeStamp_.tv_usec=0;
00154 runStartDetectedTimeStamp_.tv_sec=0;
00155 runStartDetectedTimeStamp_.tv_usec=0;
00156
00157
00158 configString_= "import FWCore.ParameterSet.Config as cms\n";
00159 configString_+="process = cms.Process(\"iDieDQM\")\n";
00160 configString_+="process.source = cms.Source(\"EmptySource\")\n";
00161 configString_+="process.DQMStore = cms.Service(\"DQMStore\",\n";
00162 configString_+=" referenceFileName = cms.untracked.string(''),\n";
00163 configString_+=" verbose = cms.untracked.int32(0),\n";
00164 configString_+=" verboseQT = cms.untracked.int32(0),\n";
00165 configString_+=" collateHistograms = cms.untracked.bool(False))\n";
00166 configString_+="process.DQM = cms.Service(\"DQM\",\n";
00167 configString_+=" debug = cms.untracked.bool(False),\n";
00168 configString_+=" publishFrequency = cms.untracked.double(1.0),\n";
00169 configString_+=" collectorPort = cms.untracked.int32(EMPTYPORT),\n";
00170 configString_+=" collectorHost = cms.untracked.string('EMPTYHOST'),\n";
00171 configString_+=" filter = cms.untracked.string(''),\n";
00172 configString_+=" verbose = cms.untracked.bool(False))\n";
00173 configString_+="process.p = cms.Path()\n";
00174
00175 epInstances = {7, 8, 12, 16, 24, 32};
00176 epMax = {8, 8, 24, 32, 24, 32};
00177 HTscaling = {1, 1, 0.28,0.28, 0.28,0.28};
00178 machineWeight = {91.6, 91.6, 253, 352, 253, 352};
00179 machineWeightInst = {80.15,91.6, 196, 275, 253, 352};
00180
00181 for (unsigned int i=0;i<epInstances.size();i++) {
00182 currentLs_.push_back(0);
00183 nbSubsList[epInstances[i]]=i;
00184 nbSubsListInv[i]=epInstances[i];
00185 std::map<unsigned int, unsigned int> mptmp;
00186 occupancyNameMap.push_back(mptmp);
00187 }
00188 nbSubsClasses = epInstances.size();
00189 lsHistory = new std::deque<lsStat*>[nbSubsClasses];
00190
00191
00192
00193 flashRunNumber_=0;
00194 cpuLoadLastLs_=0;
00195 cpuLoadSentLs_=0;
00196 std::string cpuInfoSpaceName="filterFarmUsageAndTiming";
00197 toolbox::net::URN urn = this->createQualifiedInfoSpace(cpuInfoSpaceName);
00198 cpuInfoSpace_ = xdata::getInfoSpaceFactory()->get(urn.toString());
00199 cpuInfoSpace_->fireItemAvailable("runNumber",&flashRunNumber_);
00200 cpuInfoSpace_->fireItemAvailable("lumiSection",&flashLoadLs_);
00201 cpuInfoSpace_->fireItemAvailable("hltCPULoad",&flashLoad_);
00202 cpuInfoSpace_->fireItemAvailable("systemCPULoad",&flashLoadPS_);
00203 cpuInfoSpace_->fireItemAvailable("eventTime7EP",&flashLoadTime7_);
00204 cpuInfoSpace_->fireItemAvailable("eventTime8EP",&flashLoadTime8_);
00205 cpuInfoSpace_->fireItemAvailable("eventTime12EP",&flashLoadTime12_);
00206 cpuInfoSpace_->fireItemAvailable("eventTime16EP",&flashLoadTime16_);
00207 cpuInfoSpace_->fireItemAvailable("eventTime24EP",&flashLoadTime24_);
00208 cpuInfoSpace_->fireItemAvailable("eventTime32EP",&flashLoadTime32_);
00209
00210 cpuInfoSpace_->fireItemAvailable("hltProcessingRate",&flashLoadRate_);
00211
00212 cpuInfoSpace_->fireItemAvailable("hltProcessingRate7EP",&flashLoadRate7_);
00213 cpuInfoSpace_->fireItemAvailable("hltProcessingRate8EP",&flashLoadRate8_);
00214 cpuInfoSpace_->fireItemAvailable("hltProcessingRate12EP",&flashLoadRate12_);
00215 cpuInfoSpace_->fireItemAvailable("hltProcessingRate16EP",&flashLoadRate16_);
00216 cpuInfoSpace_->fireItemAvailable("hltProcessingRate24EP",&flashLoadRate24_);
00217 cpuInfoSpace_->fireItemAvailable("hltProcessingRate32EP",&flashLoadRate32_);
00218
00219 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc7EP",&flashLoadUc7_);
00220 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc8EP",&flashLoadUc8_);
00221 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc12EP",&flashLoadUc12_);
00222 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc16EP",&flashLoadUc16_);
00223 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc24EP",&flashLoadUc24_);
00224 cpuInfoSpace_->fireItemAvailable("hltCPULoadUc32EP",&flashLoadUc32_);
00225
00226 cpuInfoSpace_->fireItemAvailable("numReports7EP", &flashReports7_);
00227 cpuInfoSpace_->fireItemAvailable("numReports8EP", &flashReports8_);
00228 cpuInfoSpace_->fireItemAvailable("numReports12EP",&flashReports12_);
00229 cpuInfoSpace_->fireItemAvailable("numReports16EP",&flashReports16_);
00230 cpuInfoSpace_->fireItemAvailable("numReports24EP",&flashReports24_);
00231 cpuInfoSpace_->fireItemAvailable("numReports32EP",&flashReports32_);
00232
00233 monNames_.push_back("runNumber");
00234 monNames_.push_back("lumiSection");
00235 monNames_.push_back("hltCPULoad");
00236 monNames_.push_back("systemCPULoad");
00237 monNames_.push_back("eventTime7EP");
00238 monNames_.push_back("eventTime8EP");
00239 monNames_.push_back("eventTime12EP");
00240 monNames_.push_back("eventTime16EP");
00241 monNames_.push_back("eventTime24EP");
00242 monNames_.push_back("eventTime32EP");
00243
00244 monNames_.push_back("hltProcessingRate");
00245 monNames_.push_back("hltProcessingRate7EP");
00246 monNames_.push_back("hltProcessingRate8EP");
00247 monNames_.push_back("hltProcessingRate12EP");
00248 monNames_.push_back("hltProcessingRate16EP");
00249 monNames_.push_back("hltProcessingRate24EP");
00250 monNames_.push_back("hltProcessingRate32EP");
00251
00252 monNames_.push_back("hltCPULoadUc7EP");
00253 monNames_.push_back("hltCPULoadUc8EP");
00254 monNames_.push_back("hltCPULoadUc12EP");
00255 monNames_.push_back("hltCPULoadUc16EP");
00256 monNames_.push_back("hltCPULoadUc24EP");
00257 monNames_.push_back("hltCPULoadUc32EP");
00258
00259 monNames_.push_back("numReports7EP");
00260 monNames_.push_back("numReports8EP");
00261 monNames_.push_back("numReports12EP");
00262 monNames_.push_back("numReports16EP");
00263 monNames_.push_back("numReports24EP");
00264 monNames_.push_back("numReports32EP");
00265
00266
00267 umask(000);
00268
00269
00270 try {
00271 toolbox::task::Timer * timer = toolbox::task::getTimerFactory()->createTimer("xmas-iDie-updater");
00272 toolbox::TimeInterval timerInterval;
00273 timerInterval.fromString("PT15S");
00274 toolbox::TimeVal timerStart;
00275 timerStart = toolbox::TimeVal::gettimeofday();
00276
00277 timer->scheduleAtFixedRate( timerStart, this, timerInterval, 0, "xmas-iDie-producer" );
00278 }
00279 catch (xdaq::exception::Exception& e) {
00280 LOG4CPLUS_WARN(getApplicationLogger(), e.what());
00281 }
00282 }
00283
00284
00285
00286 iDie::~iDie()
00287 {
00288 }
00289
00290
00291 void iDie::actionPerformed(xdata::Event& e)
00292 {
00293
00294 if (e.type()=="ItemChangedEvent" ) {
00295 std::string item = dynamic_cast<xdata::ItemChangedEvent&>(e).itemName();
00296
00297 if ( item == "runNumber") {
00298 LOG4CPLUS_WARN(getApplicationLogger(),
00299 "New Run was started - iDie will reset");
00300 reset();
00301 runActive_=true;
00302 setRunStartTimeStamp();
00303
00304 dqmState_ = "Prepared";
00305 if (dqmEnabled_.value_) {
00306 if (!evtProcessor_) initFramework();
00307 if (!meInitialized_) initMonitorElements();
00308 doFlush();
00309 }
00310 }
00311
00312 }
00313 }
00314
00315
00316 xoap::MessageReference iDie::fsmCallback(xoap::MessageReference msg)
00317 throw (xoap::exception::Exception)
00318 {
00319
00320 xoap::SOAPPart part =msg->getSOAPPart();
00321 xoap::SOAPEnvelope env =part.getEnvelope();
00322 xoap::SOAPBody body =env.getBody();
00323 DOMNode *node =body.getDOMNode();
00324 DOMNodeList *bodyList=node->getChildNodes();
00325 DOMNode *command =0;
00326 std::string commandName;
00327
00328 for (unsigned int i=0;i<bodyList->getLength();i++) {
00329 command = bodyList->item(i);
00330 if(command->getNodeType() == DOMNode::ELEMENT_NODE) {
00331 commandName = xoap::XMLCh2String(command->getLocalName());
00332 break;
00333 }
00334 }
00335
00336 if (commandName.empty()) {
00337 XCEPT_RAISE(xoap::exception::Exception,"Command not found.");
00338 }
00339
00340
00341 try {
00342
00343
00344 xoap::MessageReference reply = xoap::createMessage();
00345 xoap::SOAPEnvelope envelope = reply->getSOAPPart().getEnvelope();
00346 xoap::SOAPName responseName = envelope.createName(commandName+"Response",
00347 "xdaq",XDAQ_NS_URI);
00348 xoap::SOAPBodyElement responseElem =
00349 envelope.getBody().addBodyElement(responseName);
00350
00351
00352 std::string state;
00353 if(commandName == "Configure") {dqmState_ = "Ready"; state = "Ready";}
00354 else if(commandName == "Enable" || commandName == "Start") {
00355 dqmState_ = "Enabled"; state = "Enabled";
00356 setRunStartTimeStamp();
00357
00358 }
00359 else if(commandName == "Stop" || commandName == "Halt") {
00360 runActive_=false;
00361
00362 runTS_=0.;
00363 latencyTS_=0;
00364
00365 cpuLoadLastLs_=0;
00366 cpuLoadSentLs_=0;
00367
00368 std::cout << " Stopping/Halting iDie. command=" << commandName << " initialized=" << meInitialized_ << std::endl;
00369 if (meInitialized_) {
00370 dqmState_ = "Removed";
00371 usleep(10000);
00372 meInitialized_=false;
00373 meInitializedStreams_=false;
00374 meInitializedDatasets_=false;
00375 sleep(1);
00376
00377 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Streams/");
00378 dqmStore_->removeContents();
00379 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Datasets/");
00380 dqmStore_->removeContents();
00381 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Modules/");
00382 dqmStore_->removeContents();
00383 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Tables/");
00384 dqmStore_->removeContents();
00385 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
00386 dqmStore_->removeContents();
00387 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
00388 dqmStore_->removeContents();
00389 doFlush();
00390 }
00391 if (reportingStart_) delete reportingStart_;
00392 reportingStart_=0;
00393 state = "Ready";
00394 }
00395
00396 else state = "BOH";
00397
00398 xoap::SOAPName stateName = envelope.createName("state",
00399 "xdaq",XDAQ_NS_URI);
00400 xoap::SOAPElement stateElem = responseElem.addChildElement(stateName);
00401 xoap::SOAPName attributeName = envelope.createName("stateName",
00402 "xdaq",XDAQ_NS_URI);
00403 stateElem.addAttribute(attributeName,state);
00404
00405 return reply;
00406 }
00407 catch (toolbox::fsm::exception::Exception & e) {
00408 XCEPT_RETHROW(xoap::exception::Exception,"invalid command.",e);
00409 }
00410
00411
00412
00413 }
00414
00415
00416 void iDie::defaultWeb(xgi::Input *in,xgi::Output *out)
00417 throw (xgi::exception::Exception)
00418 {
00419 cgicc::Cgicc cgi(in);
00420 std::string method = cgi.getEnvironment().getRequestMethod();
00421 if(method == "POST"){
00422 unsigned int run = 0;
00423 std::vector<cgicc::FormEntry> el1 = cgi.getElements();
00424 cgi.getElement("run",el1);
00425 if(el1.size()!=0){
00426 run = el1[0].getIntegerValue();
00427 if(run > runNumber_.value_ || runNumber_.value_==0){
00428 runNumber_.value_ = run;
00429 runActive_=true;
00430 if(runNumber_.value_!=0)
00431 {
00432 reset();
00433 if(f_ == 0)
00434 {
00435 std::ostringstream ost;
00436 ost << "microReport"<<runNumber_<<".root";
00437 f_ = new TFile(ost.str().c_str(),"RECREATE","microreport");
00438 }
00439 }
00440 }
00441 }
00442 internal::fu fuinstance;
00443
00444 fuinstance.ccount = 0;
00445 std::string hostname = cgi.getEnvironment().getRemoteHost();
00446 std::transform(hostname.begin(), hostname.end(),
00447 hostname.begin(), ::toupper);
00448 fus_[hostname] = fuinstance;
00449 }
00450 else{
00451 *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
00452 << "<html><head><title>" << getApplicationDescriptor()->getClassName()
00453 << getApplicationDescriptor()->getInstance() << "</title>"
00454 << "<meta http-equiv=\"REFRESH\" content=\"0;url=/evf/html/idiePage.html\">"
00455 << "</head></html>";
00456 }
00457 }
00458
00459
00460 void iDie::updater(xgi::Input *in,xgi::Output *out)
00461 throw (xgi::exception::Exception)
00462 {
00463 *out << runNumber_.value_ << std::endl;
00464 }
00465
00466 void iDie::summaryTable(xgi::Input *in,xgi::Output *out)
00467 throw (xgi::exception::Exception)
00468 {
00469 *out << "<tr><td>"<<fus_.size()<<"</td><td>" << totalCores_
00470 << "</td><td></td></tr>" << std::endl;
00471 }
00472
00473
00474 void iDie::detailsTable(xgi::Input *in,xgi::Output *out)
00475 throw (xgi::exception::Exception)
00476 {
00477 timeval tv;
00478 gettimeofday(&tv,0);
00479 time_t now = tv.tv_sec;
00480 for(ifmap i = fus_.begin(); i != fus_.end(); i++)
00481 if((*i).second.ccount != 0){
00482 *out << "<tr><td "
00483 << (now-(*i).second.tstamp<300 ? "style=\"background-color:red\"" : "")
00484 << ">"<<(*i).first<<"</td><td>"
00485 << (*i).second.ccount << "</td>"
00486 << "<td onClick=loaddump(\'" << url_.value_ << "/dump?name="
00487 << (*i).first << "\')>" << (*i).second.cpids.back()
00488 << "</td><td>" <<(*i).second.signals.back()
00489 << "</td></tr>" << std::endl;
00490 }
00491 }
00492
00493
00494 void iDie::dumpTable(xgi::Input *in,xgi::Output *out)
00495 throw (xgi::exception::Exception)
00496 {
00497 cgicc::Cgicc cgi(in);
00498
00499 std::vector<cgicc::FormEntry> el1;
00500 cgi.getElement("name",el1);
00501 if(el1.size()!=0){
00502 std::string hostname = el1[0].getValue();
00503 std::transform(hostname.begin(), hostname.end(),
00504 hostname.begin(), ::toupper);
00505 ifmap fi = fus_.find(hostname);
00506 if(fi!=fus_.end()){
00507 *out << (*fi).second.stacktraces.back() << std::endl;
00508 }
00509 else{
00510 for(fi=fus_.begin(); fi != fus_.end(); fi++)
00511 std::cout << "known hosts: " << (*fi).first << std::endl;
00512 }
00513 }
00514 }
00515
00516
00517 void iDie::iChokeMiniInterface(xgi::Input *in,xgi::Output *out)
00518 throw (xgi::exception::Exception)
00519 {
00520 unsigned int i = 0;
00521
00522 if(last_ls_==0) return;
00523 *out << "<div id=\"cls\">" << last_ls_ << "</div>"
00524 << "<div id=\"clr\">" << cpuentries_[last_ls_-1] << "</div>" << std::endl;
00525 sorted_indices tmp(cpustat_[last_ls_-1]);
00526
00527 *out << "<tbody id=\"cpue\">";
00528 while(i<nstates_){
00529 if(tmp[i]!=0) *out << "<tr><td>" << mapmod_[tmp.ii(i)] << "</td>" << "<td>"
00530 << float(tmp[i])/float(cpuentries_[last_ls_-1]) << "</td></tr>";
00531 i++;
00532 }
00533 *out << "</tbody>\n";
00534 *out << "<tbody id=\"cpui\"><tr><td></td>";
00535 unsigned int begin = last_ls_<5 ? 0 : last_ls_-5;
00536 for(i=begin; i < last_ls_; i++)
00537 *out << "<td>" << i +1 << "</td>";
00538 *out << "</tr><tr><td></td>";
00539 for(i=begin; i < last_ls_; i++)
00540 *out << "<td>" << float(cpustat_[i][2])/float(cpuentries_[i]) << "</td>";
00541 *out << "</tr></tbody>\n";
00542
00543 *out << "<tbody id=\"rate\"><tr><td></td>";
00544 begin = last_ls_<5 ? 0 : last_ls_-5;
00545 for(i=begin; i < last_ls_; i++)
00546 *out << "<td>" << float(trp_[i].eventSummary.totalEventsPassed)/float(trp_[i].eventSummary.totalEvents) << "</td>";
00547 *out << "</tr>\n<tr><td></td>";
00548 for(i=begin; i < last_ls_; i++)
00549 *out << "<td>" << trp_[i].eventSummary.totalEvents << "</td>";
00550 *out << "</tr>\n<tr><td></td>";
00551 for(int j = 0; j < trp_[0].trigPathsInMenu; j++)
00552 {
00553 *out << "<tr><td></td>";
00554 for(i=begin; i < last_ls_; i++)
00555 *out << "<td>" << trp_[i].trigPathSummaries[j].timesPassed << "("
00556 << trp_[i].trigPathSummaries[j].timesPassedL1 << ")("
00557 << trp_[i].trigPathSummaries[j].timesPassedPs << ")</td>";
00558 *out << "<td>" << mappath_[j] << "</td>";
00559 *out << "</tr>\n";
00560 }
00561 for(int j = 0; j < trp_[0].endPathsInMenu; j++)
00562 {
00563 *out << "<tr><td></td>";
00564 for(i=begin; i < last_ls_; i++)
00565 *out << "<td>" << trp_[i].endPathSummaries[j].timesPassed << "</td>";
00566 *out << "<td>" << mappath_[j+trp_[last_ls_-1].trigPathsInMenu] << "</td>";
00567 *out << "</tr>\n";
00568 }
00569 *out << "</tbody>\n";
00570 }
00571
00572
00573 void iDie::iChoke(xgi::Input *in,xgi::Output *out)
00574 throw (xgi::exception::Exception)
00575 {
00576 *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
00577 << "<html><head><title>" << getApplicationDescriptor()->getClassName()
00578 << getApplicationDescriptor()->getInstance() << "</title>"
00579 << "<meta http-equiv=\"REFRESH\" content=\"0;url=/evf/html/ichokePage.html\">"
00580 << "</head></html>";
00581
00582
00583
00584 }
00585
00586
00587 void iDie::postEntry(xgi::Input*in,xgi::Output*out)
00588 throw (xgi::exception::Exception)
00589 {
00590
00591 timeval tv;
00592 gettimeofday(&tv,0);
00593 time_t now = tv.tv_sec;
00594
00595 try {
00596 cgicc::Cgicc cgi(in);
00597 unsigned int run = 0;
00598 pid_t cpid = 0;
00599
00600
00601
00602 std::vector<cgicc::FormEntry> el1;
00603 el1 = cgi.getElements();
00604
00605
00606 el1.clear();
00607 cgi.getElement("run",el1);
00608 if(el1.size()!=0)
00609 {
00610 run = el1[0].getIntegerValue();
00611 }
00612 el1.clear();
00613 cgi.getElement("stacktrace",el1);
00614 if(el1.size()!=0)
00615 {
00616 cpid = run;
00617
00618
00619 if(el1[0].getValue().find("Dead")==0){
00620
00621 std::string host = cgi.getEnvironment().getRemoteHost();
00622 std::transform(host.begin(), host.end(),
00623 host.begin(), ::toupper);
00624 ifmap fi = fus_.find(host);
00625 if(fi!=fus_.end()){
00626 fus_.erase(fi);
00627 }
00628 if(fus_.size()==0) {
00629
00630 if(f_!=0){
00631 f_->cd();
00632 f_->Write();
00633 }
00634 if(t_ != 0) {
00635 delete t_;
00636 t_ = 0;
00637 }
00638 if(f_!=0){
00639 f_->Close();
00640 delete f_; f_ = 0;
00641 }
00642 }
00643 }
00644 else{
00645 totalCores_++;
00646 std::string st = el1[0].getValue();
00647 std::string sig;
00648 size_t psig = st.find("signal");
00649 if(psig != std::string::npos)
00650 sig = st.substr(psig,9);
00651 std::string host = cgi.getEnvironment().getRemoteHost();
00652 std::transform(host.begin(), host.end(),
00653 host.begin(), ::toupper);
00654 ifmap fi = fus_.find(host);
00655 if(fi!=fus_.end()){
00656 (*fi).second.tstamp = now;
00657 (*fi).second.ccount++;
00658 (*fi).second.cpids.push_back(cpid);
00659 (*fi).second.signals.push_back(sig);
00660 (*fi).second.stacktraces.push_back(st);
00661 }
00662 }
00663 }
00664 el1.clear();
00665 cgi.getElement("legenda",el1);
00666 if(el1.size()!=0)
00667 {
00668 parsePathLegenda(el1[0].getValue());
00669 }
00670 cgi.getElement("LegendaAux",el1);
00671 if (el1.size()!=0)
00672 {
00673 parseDatasetLegenda(el1[0].getValue());
00674 }
00675 cgi.getElement("trp",el1);
00676 if(el1.size()!=0)
00677 {
00678 unsigned int lsid = run;
00679 parsePathHisto((unsigned char*)(el1[0].getValue().c_str()),lsid);
00680 }
00681 el1.clear();
00682 }
00683 catch (edm::Exception &e) {
00684 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught edm exception in postEntry: " << e.what());
00685 }
00686 catch (cms::Exception &e) {
00687 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught cms exception in postEntry: " << e.what());
00688 }
00689 catch (std::exception &e) {
00690 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught std exception in postEntry: " << e.what());
00691 }
00692 catch (...) {
00693 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught unknown exception in postEntry");
00694 }
00695
00696 }
00697
00698
00699 void iDie::postEntryiChoke(xgi::Input*in,xgi::Output*out)
00700 throw (xgi::exception::Exception)
00701 {
00702
00703
00704 if (dqmEnabled_.value_) {
00705 if (!evtProcessor_) initFramework();
00706 if (!meInitialized_) {
00707 if (dqmState_!="Removed") initMonitorElements();
00708 }
00709 }
00710
00711
00712 unsigned int lsid = 0;
00713 try {
00714 cgicc::Cgicc cgi(in);
00715
00716
00717
00718 std::vector<cgicc::FormEntry> el1;
00719 el1 = cgi.getElements();
00720
00721
00722 el1.clear();
00723 cgi.getElement("run",el1);
00724 if(el1.size()!=0)
00725 {
00726 lsid = el1[0].getIntegerValue();
00727 }
00728 el1.clear();
00729
00730
00731
00732
00733 if(lsid!=0){
00734 if(lsid>cpustat_.size()){
00735 cpustat_.resize(lsid,std::vector<int>(nstates_,0));
00736 cpuentries_.resize(lsid,0);
00737 }
00738 if(lsid>trp_.size()){
00739 trp_.resize(lsid);
00740 funcs::reset(&trp_[lsid-1]);
00741 trpentries_.resize(lsid,0);
00742 }
00743 if(last_ls_ < lsid) {
00744 last_ls_ = lsid;
00745 funcs::reset(&trp_[lsid-1]);
00746 if(t_ && (last_ls_%10==0)) t_->Write();
00747 }
00748 }
00749
00750 cgi.getElement("legenda",el1);
00751 if(el1.size()!=0)
00752 {
00753 parseModuleLegenda(el1[0].getValue());
00754 }
00755 cgi.getElement("trp",el1);
00756 if(el1.size()!=0)
00757 {
00758 parseModuleHisto(el1[0].getValue().c_str(),lsid);
00759 }
00760 el1.clear();
00761 }
00762
00763 catch (edm::Exception &e) {
00764 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught edm exception in postEntryiChoke: " << e.what());
00765 }
00766 catch (cms::Exception &e) {
00767 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught cms exception in postEntryiChoke: " << e.what());
00768 }
00769 catch (std::exception &e) {
00770 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught std exception in postEntryiChoke: " << e.what());
00771 }
00772 catch (...) {
00773 LOG4CPLUS_ERROR(getApplicationLogger(),"Caught unknown exception in postEntryiChoke");
00774 }
00775 }
00776
00777
00778 void iDie::reset()
00779 {
00780 fus_.erase(fus_.begin(),fus_.end());
00781 totalCores_=0;
00782 last_ls_ = 0;
00783 trp_.clear();
00784 trpentries_.clear();
00785 cpustat_.clear();
00786 cpuentries_.clear();
00787
00788 if(f_!=0){
00789 f_->cd();
00790 f_->Write();
00791 }
00792
00793 if(t_ != 0)
00794 {
00795 delete t_; t_=0;
00796 }
00797
00798 if(f_!=0){
00799 f_->Close();
00800 delete f_; f_ = 0;
00801 }
00802 if(datap_ != 0)
00803 {delete datap_; datap_ = 0;}
00804 b_=0; b1_=0; b2_=0; b3_=0; b4_=0;
00805
00806 }
00807
00808 void iDie::parseModuleLegenda(std::string leg)
00809 {
00810 nModuleLegendaMessageReceived_++;
00811 if(leg=="") return;
00812 gettimeofday(&lastModuleLegendaMessageTimeStamp_,0);
00813 nModuleLegendaMessageWithDataReceived_++;
00814 mapmod_.clear();
00815
00816 boost::char_separator<char> sep(",");
00817 boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
00818 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
00819 tok_iter != tokens.end(); ++tok_iter){
00820 mapmod_.push_back((*tok_iter));
00821 }
00822 nstates_ = mapmod_.size();
00823
00824
00825
00826
00827 }
00828
00829 void iDie::parseModuleHisto(const char *crp, unsigned int lsid)
00830 {
00831 if(lsid==0) return;
00832 nModuleHistoMessageReceived_++;
00833 int *trp = (int*)crp;
00834 if(t_==0 && f_!=0){
00835 datap_ = new int[nstates_+5];
00836 std::ostringstream ost;
00837 ost<<mapmod_[0]<<"/I";
00838 for(unsigned int i = 1; i < nstates_; i++)
00839 ost<<":"<<mapmod_[i];
00840 ost<<":nsubp:instance:nproc:ncpubusy";
00841 f_->cd();
00842 t_ = new TTree("microReport","microstate report tree");
00843 t_->SetAutoSave(500000);
00844 b_ = t_->Branch("microstates",datap_,ost.str().c_str());
00845 b1_ = t_->Branch("ls",&lsid,"ls/I");
00846
00847 }
00848
00849 memcpy(datap_,trp,(nstates_+5)*sizeof(int));
00850
00851 unsigned int datapLen_ = nstates_+5;
00852 unsigned int nbsubs_ = datap_[datapLen_-5];
00853 unsigned int nbproc_ = datap_[datapLen_-3];
00854 unsigned int ncpubusy_ = datap_[datapLen_-2];
00855 unsigned int deltaTms_ = datap_[datapLen_-1];
00856
00857
00858 int nbsIdx = -1;
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873 if (meInitialized_ && nbSubsList.find(nbsubs_)!=nbSubsList.end() && lsid) {
00874 nbsIdx = nbSubsList[nbsubs_];
00875 if (currentLs_[nbsIdx]<lsid) {
00876 if (currentLs_[nbsIdx]!=0) {
00877 if (lsHistory[nbsIdx].size()) {
00878
00879
00880 runId_->Fill(runNumber_.value_);
00881 lumisecId_->Fill(currentLs_[nbsIdx]);
00882 struct timeval now;
00883 gettimeofday(&now, 0);
00884 double time_now = now.tv_sec + 1e-6*now.tv_usec;
00885 eventTimeStamp_->Fill( time_now );
00886
00887
00888 double runTS = runTS_;
00889 if (runTS==0.)
00890 runTS_ = time_now;
00891
00892 runStartTimeStamp_->Fill(runTS);
00893
00894 processLatencyMe_->Fill(time_now-latencyTS_);
00895 latencyTS_=time_now;
00896 processTimeStampMe_->Fill(time_now);
00897
00898
00899 lsStat * lst = lsHistory[nbsIdx].back();
00900 fillDQMStatHist(nbsIdx,currentLs_[nbsIdx]);
00901 fillDQMModFractionHist(nbsIdx,currentLs_[nbsIdx],lst->getNSampledNonIdle(),
00902 lst->getOffendersVector());
00903 doFlush();
00904 perLumiFileSaver(currentLs_[nbsIdx]);
00905 perTimeFileSaver();
00906 }
00907 }
00908
00909 currentLs_[nbsIdx]=lsid;
00910
00911
00912 unsigned int lclast = commonLsHistory.size() ? commonLsHistory.back()->ls_:0;
00913 for (unsigned int newls=lclast+1;newls<=lsid;newls++) {
00914 commonLsHistory.push_back(new commonLsStat(newls,epInstances.size()));
00915 }
00916
00917 unsigned int lhlast = lsHistory[nbsIdx].size() ? lsHistory[nbsIdx].back()->ls_:0;
00918 for (size_t newls=lhlast+1;newls<=lsid;newls++) {
00919 lsHistory[nbsIdx].push_back(new lsStat(newls,nbsubs_,nModuleLegendaMessageReceived_,nstates_));
00920 }
00921
00922
00923 while (commonLsHistory.size()>ROLL) {delete commonLsHistory.front(); commonLsHistory.pop_front();}
00924 while (lsHistory[nbsIdx].size()>ROLL) {delete lsHistory[nbsIdx].front(); lsHistory[nbsIdx].pop_front();}
00925 }
00926 if (currentLs_[nbsIdx]>=lsid) {
00927 unsigned int qsize=lsHistory[nbsIdx].size();
00928 unsigned int delta = currentLs_[nbsIdx]-lsid;
00929 if (qsize>delta && delta<ROLL) {
00930 lsStat * lst = (lsHistory[nbsIdx])[qsize-delta-1];
00931 unsigned int cumulative_ = 0;
00932 auto fillvec = lst->getModuleSamplingPtr();
00933 for (unsigned int i=0;i<nstates_;i++) {
00934 cumulative_+=datap_[i];
00935 if (fillvec) {
00936 fillvec[i].second+=datap_[i];
00937 }
00938 }
00939 unsigned int busyCounts = cumulative_-datap_[2];
00940 lst->update(busyCounts,datap_[2],nbproc_,ncpubusy_,deltaTms_);
00941 }
00942 }
00943 }
00944 else {
00945
00946 }
00947
00948 if(t_!=0){
00949 t_->SetEntries(t_->GetEntries()+1); b_->Fill(); b1_->Fill();
00950 }
00951
00952 for(unsigned int i=0;i<nstates_; i++)
00953 {
00954 cpustat_[lsid-1][i] += trp[i];
00955 cpuentries_[lsid-1] += trp[i];
00956 }
00957 }
00958
00959
00960 void iDie::parsePathLegenda(std::string leg)
00961 {
00962 nPathLegendaMessageReceived_++;
00963 if(leg=="")return;
00964 gettimeofday(&lastPathLegendaMessageTimeStamp_,0);
00965 nPathLegendaMessageWithDataReceived_++;
00966 mappath_.clear();
00967 boost::char_separator<char> sep(",");
00968 boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
00969 endPathNames_.clear();
00970 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
00971 tok_iter != tokens.end(); ++tok_iter){
00972 mappath_.push_back((*tok_iter));
00973
00974 if (std::string(*tok_iter).find("Output")!=std::string::npos) {
00975 std::string path_token = *tok_iter;
00976 if (path_token.find("=")!=std::string::npos)
00977 endPathNames_.push_back(path_token.substr(path_token.find("=")+1));
00978 else
00979 endPathNames_.push_back(*tok_iter);
00980 }
00981 }
00982
00983 if (!endPathNames_.size()) {
00984
00985 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
00986 tok_iter != tokens.end(); ++tok_iter){
00987
00988 if (std::string(*tok_iter).find("output")!=std::string::npos) {
00989 std::string path_token = *tok_iter;
00990 if (path_token.find("=")!=std::string::npos)
00991 endPathNames_.push_back(path_token.substr(path_token.find("=")+1));
00992 else
00993 endPathNames_.push_back(*tok_iter);
00994 }
00995 }
00996 }
00997 }
00998
00999 void iDie::parseDatasetLegenda(std::string leg)
01000 {
01001 nDatasetLegendaMessageReceived_++;
01002 datasetNames_.clear();
01003 dsMismatch=0;
01004 if(leg=="")return;
01005 gettimeofday(&lastDatasetLegendaMessageTimeStamp_,0);
01006 nDatasetLegendaMessageWithDataReceived_++;
01007 try {
01008 boost::char_separator<char> sep(",");
01009 boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
01010 for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
01011 tok_iter != tokens.end(); ++tok_iter) {
01012 datasetNames_.push_back((*tok_iter));
01013 }
01014 }
01015 catch (...) {}
01016 }
01017
01018 void iDie::parsePathHisto(const unsigned char *crp, unsigned int lsid)
01019 {
01020 if(lsid==0) return;
01021 nPathHistoMessageReceived_++;
01022
01023
01024
01025
01026
01027 trppriv_ = (TriggerReportStatic*)crp;
01028 for( int i=0; i< trppriv_->trigPathsInMenu; i++)
01029 {
01030 r_.ptimesRun[i] = trppriv_->trigPathSummaries[i].timesRun;
01031 r_.ptimesPassedPs[i] = trppriv_->trigPathSummaries[i].timesPassedPs;
01032 r_.ptimesPassedL1[i] = trppriv_->trigPathSummaries[i].timesPassedL1;
01033 r_.ptimesPassed[i] = trppriv_->trigPathSummaries[i].timesPassed;
01034 r_.ptimesFailed[i] = trppriv_->trigPathSummaries[i].timesFailed;
01035 r_.ptimesExcept[i] = trppriv_->trigPathSummaries[i].timesExcept;
01036 }
01037
01038 commonLsStat * cst = 0;
01039 if (meInitialized_) {
01040 if (commonLsHistory.size()) cst=commonLsHistory.back();
01041 if (cst && cst->ls_>=lsid) {
01042 unsigned int countback=commonLsHistory.size()-1;
01043 while (cst->ls_>lsid && countback) {
01044 countback--;
01045 cst=commonLsHistory[countback];
01046 }
01047 }
01048 }
01049
01050 for( int i=0; i< trppriv_->endPathsInMenu; i++)
01051 {
01052 r_.etimesRun[i] = trppriv_->endPathSummaries[i].timesRun;
01053 r_.etimesPassedPs[i] = trppriv_->endPathSummaries[i].timesPassedPs;
01054 r_.etimesPassedL1[i] = trppriv_->endPathSummaries[i].timesPassedL1;
01055 r_.etimesPassed[i] = trppriv_->endPathSummaries[i].timesPassed;
01056 r_.etimesFailed[i] = trppriv_->endPathSummaries[i].timesFailed;
01057 r_.etimesExcept[i] = trppriv_->endPathSummaries[i].timesExcept;
01058 if (cst) {
01059 if ((unsigned)i < cst->endPathCounts_.size()) cst->endPathCounts_[i]+=r_.etimesPassed[i];
01060 else cst->endPathCounts_.push_back(r_.etimesPassed[i]);
01061 }
01062 }
01063
01064
01065 if (trppriv_->datasetsInMenu!=(int)datasetNames_.size())
01066 {
01067 dsMismatch++;
01068 if (!(dsMismatch%100) || dsMismatch<10) {
01069 LOG4CPLUS_WARN(getApplicationLogger(),"mismatch in number of datasets! "
01070 << trppriv_->datasetsInMenu << " in report, " << datasetNames_.size()
01071 << " from legend! received legends:"<< nDatasetLegendaMessageWithDataReceived_);
01072 }
01073 }
01074
01075 for( int i=0; i< trppriv_->datasetsInMenu; i++)
01076 {
01077 if (cst) {
01078 if ((unsigned)i < cst->datasetCounts_.size()) cst->datasetCounts_[i]+=trppriv_->datasetSummaries[i].timesPassed;
01079 else cst->datasetCounts_.push_back(trppriv_->datasetSummaries[i].timesPassed);
01080 }
01081 }
01082
01083 r_.nproc = trppriv_->eventSummary.totalEvents;
01084 r_.nsub = trppriv_->nbExpected;
01085 r_.nrep = trppriv_->nbReporting;
01086
01087
01088 if(t_!=0 && f_!=0 && b2_==0){
01089
01090 b2_ = t_->Branch("rate",&r_,"nproc/I:nsub:nrep");
01091 std::ostringstream ost1;
01092 ost1 << "p_nrun[" << trppriv_->trigPathsInMenu
01093 << "]/I:p_npps[" << trppriv_->trigPathsInMenu
01094 << "]:p_npl1[" << trppriv_->trigPathsInMenu
01095 << "]:p_npp[" << trppriv_->trigPathsInMenu
01096 << "]:p_npf[" << trppriv_->trigPathsInMenu
01097 << "]:p_npe[" << trppriv_->trigPathsInMenu <<"]";
01098
01099 b3_ = t_->Branch("paths",r_.ptimesRun,ost1.str().c_str());
01100 std::ostringstream ost2;
01101 ost2 << "ep_nrun[" << trppriv_->endPathsInMenu
01102 << "]/I:en_npps[" << trppriv_->endPathsInMenu
01103 << "]:ep_npl1[" << trppriv_->endPathsInMenu
01104 << "]:ep_npp[" << trppriv_->endPathsInMenu
01105 << "]:ep_npf[" << trppriv_->endPathsInMenu
01106 << "]:ep_npe[" << trppriv_->endPathsInMenu << "]";
01107 b4_ = t_->Branch("endpaths",r_.etimesRun,ost2.str().c_str());
01108 }
01109 if(b2_!=0) b2_->Fill();
01110 if(b3_!=0) b3_->Fill();
01111 if(b4_!=0) b4_->Fill();
01112
01113 funcs::addToReport(&trp_[lsid-1],trppriv_,lsid);
01114 trpentries_[lsid-1]++;
01115
01116 }
01117
01118
01119
01120 void iDie::spotlight(xgi::Input *in,xgi::Output *out)
01121 throw (xgi::exception::Exception)
01122 {
01123
01124 std::string urn = getApplicationDescriptor()->getURN();
01125
01126 *out << "<!-- base href=\"/" << urn
01127 << "\"> -->" << std::endl;
01128 *out << "<html>" << std::endl;
01129 *out << "<head>" << std::endl;
01130 *out << "<link type=\"text/css\" rel=\"stylesheet\"";
01131 *out << " href=\"/evf/html/styles.css\"/>" << std::endl;
01132 *out << "<title>" << getApplicationDescriptor()->getClassName()
01133 << getApplicationDescriptor()->getInstance()
01134 << " MAIN</title>" << std::endl;
01135 *out << "</head>" << std::endl;
01136 *out << "<body>" << std::endl;
01137 *out << "<table border=\"0\" width=\"100%\">" << std::endl;
01138 *out << "<tr>" << std::endl;
01139 *out << " <td align=\"left\">" << std::endl;
01140 *out << " <img" << std::endl;
01141 *out << " align=\"middle\"" << std::endl;
01142 *out << " src=\"/evf/images/spoticon.jpg\"" << std::endl;
01143 *out << " alt=\"main\"" << std::endl;
01144 *out << " width=\"64\"" << std::endl;
01145 *out << " height=\"64\"" << std::endl;
01146 *out << " border=\"\"/>" << std::endl;
01147 *out << " <b>" << std::endl;
01148 *out << getApplicationDescriptor()->getClassName()
01149 << getApplicationDescriptor()->getInstance() << std::endl;
01150 *out << " </b>" << std::endl;
01151 *out << " </td>" << std::endl;
01152 *out << " <td width=\"32\">" << std::endl;
01153 *out << " <a href=\"/urn:xdaq-application:lid=3\">" << std::endl;
01154 *out << " <img" << std::endl;
01155 *out << " align=\"middle\"" << std::endl;
01156 *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << std::endl;
01157 *out << " alt=\"HyperDAQ\"" << std::endl;
01158 *out << " width=\"32\"" << std::endl;
01159 *out << " height=\"32\"" << std::endl;
01160 *out << " border=\"\"/>" << std::endl;
01161 *out << " </a>" << std::endl;
01162 *out << " </td>" << std::endl;
01163 *out << " <td width=\"32\">" << std::endl;
01164 *out << " </td>" << std::endl;
01165 *out << " <td width=\"32\">" << std::endl;
01166 *out << " <a href=\"/" << urn << "/\">" << std::endl;
01167 *out << " <img" << std::endl;
01168 *out << " align=\"middle\"" << std::endl;
01169 *out << " src=\"/evf/images/idieapp.jpg\"" << std::endl;
01170 *out << " alt=\"main\"" << std::endl;
01171 *out << " width=\"32\"" << std::endl;
01172 *out << " height=\"32\"" << std::endl;
01173 *out << " border=\"\"/>" << std::endl;
01174 *out << " </a>" << std::endl;
01175 *out << " </td>" << std::endl;
01176 *out << "</tr>" << std::endl;
01177 *out << "</table>" << std::endl;
01178 *out << "<hr/>" << std::endl;
01179 *out << "<table><tr><th>Parameter</th><th>Value</th></tr>" << std::endl;
01180 *out << "<tr><td>module legenda messages received</td><td>"
01181 << nModuleLegendaMessageReceived_ << "</td></tr>" << std::endl;
01182 *out << "<tr><td>path legenda messages received</td><td>"
01183 << nPathLegendaMessageReceived_ << "</td></tr>" << std::endl;
01184 *out << "<tr><td>module legenda messages with data</td><td>"
01185 << nModuleLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
01186 *out << "<tr><td>path legenda messages with data</td><td>"
01187 << nPathLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
01188 *out << "<tr><td>dataset legenda messages with data</td><td>"
01189 << nDatasetLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
01190 *out << "<tr><td>module histo messages received</td><td>"
01191 << nModuleHistoMessageReceived_<< "</td></tr>" << std::endl;
01192 *out << "<tr><td>path histo messages received</td><td>"
01193 << nPathHistoMessageReceived_<< "</td></tr>" << std::endl;
01194 tm *uptm = localtime(&lastPathLegendaMessageTimeStamp_.tv_sec);
01195 char datestring[256];
01196 strftime(datestring, sizeof(datestring),"%c", uptm);
01197 *out << "<tr><td>time stamp of last path legenda with data</td><td>"
01198 << datestring << "</td></tr>" << std::endl;
01199 uptm = localtime(&lastModuleLegendaMessageTimeStamp_.tv_sec);
01200 strftime(datestring, sizeof(datestring),"%c", uptm);
01201 *out << "<tr><td>time stamp of last module legenda with data</td><td>"
01202 << datestring << "</td></tr>" << std::endl;
01203 *out << "</table></body>" << std::endl;
01204
01205 }
01206
01207 void iDie::initFramework()
01208 {
01209
01210
01211
01212
01213 std::string configuration_ = configString_;
01214 configuration_.replace(configuration_.find("EMPTYHOST"),9,dqmCollectorHost_.value_);
01215
01216
01217 {
01218 std::string & s = dqmCollectorPort_.value_;
01219 std::string::const_iterator it = s.begin();
01220 while (it != s.end() && std::isdigit(*it)) ++it;
01221 if (it != s.end() || s.empty()) dqmCollectorPort_="0";
01222 }
01223 configuration_.replace(configuration_.find("EMPTYPORT"),9,dqmCollectorPort_.value_);
01224
01225 PythonProcessDesc ppdesc = PythonProcessDesc(configuration_);
01226 boost::shared_ptr<edm::ProcessDesc> pdesc;
01227 std::vector<std::string> defaultServices = {"InitRootHandlers"};
01228 pdesc = ppdesc.processDesc();
01229 pdesc->addServices(defaultServices);
01230
01231 if (!pServiceSets_) {
01232 pServiceSets_ = pdesc->getServicesPSets();
01233 edmplugin::PluginManager::configure(edmplugin::standard::config());
01234 }
01235 try {
01236 edm::PresenceFactory *pf = edm::PresenceFactory::get();
01237 if(pf != 0) {
01238 pf->makePresence("MessageServicePresence").release();
01239 }
01240 else {
01241 LOG4CPLUS_WARN(getApplicationLogger(),"Unable to create message service presence");
01242 }
01243 }
01244 catch(edm::Exception e) {
01245 LOG4CPLUS_WARN(getApplicationLogger(),e.what());
01246 }
01247
01248 catch(cms::Exception e) {
01249 LOG4CPLUS_WARN(getApplicationLogger(),e.what());
01250 }
01251
01252 catch(std::exception e) {
01253 LOG4CPLUS_WARN(getApplicationLogger(),e.what());
01254 }
01255 catch(...) {
01256 LOG4CPLUS_WARN(getApplicationLogger(),"Unknown Exception (Message Presence)");
01257 }
01258
01259 try {
01260 serviceToken_ = edm::ServiceRegistry::createSet(*pServiceSets_);
01261 }
01262 catch (...) {
01263 LOG4CPLUS_WARN(getApplicationLogger(),"Failed creation of service token ");
01264 dqmEnabled_.value_=false;
01265 }
01266 edm::ServiceRegistry::Operate operate(serviceToken_);
01267
01268 evtProcessor_ = new edm::EventProcessor(pdesc,
01269 serviceToken_,
01270 edm::serviceregistry::kTokenOverrides);
01271
01272 try{
01273 if(edm::Service<DQMStore>().isAvailable())
01274 dqmStore_ = edm::Service<DQMStore>().operator->();
01275 }
01276 catch(...) {
01277 LOG4CPLUS_WARN(getApplicationLogger(),"exception when trying to get service DQMStore");
01278 dqmEnabled_.value_=false;
01279 }
01280 try{
01281 if(edm::Service<DQMService>().isAvailable())
01282 dqmService_ = edm::Service<DQMService>().operator->();
01283 }
01284 catch(...) {
01285 LOG4CPLUS_WARN(getApplicationLogger(),"exception when trying to get service DQMService");
01286 dqmEnabled_.value_=false;
01287 }
01288 if (!dqmEnabled_.value_) LOG4CPLUS_ERROR(getApplicationLogger(),"Failed to initialize DQMService/DQMStore");
01289
01290 if (dqmState_!="Removed")
01291 initMonitorElements();
01292
01293 }
01294
01295 void iDie::initMonitorElements()
01296 {
01297 if (!evtProcessor_) return;
01298 dqmStore_->cd();
01299
01300 meVecRate_.clear();
01301 meVecTime_.clear();
01302 meVecCPU_.clear();
01303 meVecOffenders_.clear();
01304 for (unsigned int i=0;i<epInstances.size();i++) {
01305 currentLs_[i]=0;
01306 }
01307 ilumiprev_ = 0;
01308 savedForLs_=0;
01309 summaryLastLs_ = 0;
01310 pastSavedFiles_.clear();
01311
01312 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
01313 runId_ = dqmStore_->bookInt("iRun");
01314 runId_->Fill(-1);
01315 lumisecId_ = dqmStore_->bookInt("iLumiSection");
01316 lumisecId_->Fill(-1);
01317 eventId_ = dqmStore_->bookInt("iEvent");
01318 eventId_->Fill(-1);
01319 eventTimeStamp_ = dqmStore_->bookFloat("eventTimeStamp");
01320 runStartTimeStamp_ = dqmStore_->bookFloat("runStartTimeStamp");
01321 initDQMEventInfo();
01322
01323 for (unsigned int i=0;i<nbSubsClasses;i++) {
01324 std::ostringstream str;
01325 str << nbSubsListInv[i];
01326 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
01327 meVecRate_.push_back(dqmStore_->book1D("EVENT_RATE_"+TString(str.str().c_str()),
01328 "Average event rate for nodes with " + TString(str.str().c_str()) + " EP instances",
01329 4000,1.,4001));
01330 meVecTime_.push_back(dqmStore_->book1D("EVENT_TIME_"+TString(str.str().c_str()),
01331 "Average event processing time for nodes with " + TString(str.str().c_str()) + " EP instances",
01332 4000,1.,4001));
01333 meVecCPU_.push_back(dqmStore_->book1D("UNCORR_CPUUSAGE_"+TString(str.str().c_str())+"_reportSummaryMap",
01334 "Average CPU (%) usage for nodes with " + TString(str.str().c_str()) + " EP instances",
01335 4000,1.,4001));
01336 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Modules/");
01337 meVecOffenders_.push_back(dqmStore_->book2D("MODULE_FRACTION_"+TString(str.str().c_str()),
01338 "Module processing time fraction_"+ TString(str.str().c_str()),
01339 ROLL,1.,1.+ROLL,MODNAMES,0,MODNAMES));
01340
01341 meVecOffenders_[i]->Fill(0,1);
01342 occupancyNameMap[i].clear();
01343 }
01344
01345
01346 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Tables");
01347 rateSummary_ = dqmStore_->book2D("00_RATE_SUMMARY","Rate Summary (Hz)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
01348 reportPeriodSummary_ = dqmStore_->book2D("00_REPORT_PERIOD_SUMMARY","Average report period (s)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
01349 timingSummary_ = dqmStore_->book2D("01_TIMING_SUMMARY","Event Time Summary (ms)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
01350 busySummary_ = dqmStore_->book2D("02_BUSY_SUMMARY","Busy fraction ",ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
01351 busySummary2_ = dqmStore_->book2D("03_BUSY_SUMMARY_PROCSTAT","Busy fraction from /proc/stat",ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
01352 busySummaryUncorr1_ = dqmStore_->book2D("04_BUSY_SUMMARY_UNCORR","Busy fraction (uncorrected)",
01353 ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
01354 busySummaryUncorr2_ = dqmStore_->book2D("05_BUSY_SUMMARY_UNCORR_PROCSTAT","Busy fraction from /proc/stat(uncorrected)",
01355 ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
01356 fuReportsSummary_ = dqmStore_->book2D("06_EP_REPORTS_SUMMARY","Number of reports received",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
01357
01358
01359 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
01360 std::ostringstream busySummaryTitle;
01361 busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
01362 lastRunNumberSet_ = runNumber_.value_;
01363 daqBusySummary_ = dqmStore_->book1D("00 reportSummaryMap",busySummaryTitle.str(),4000,1,4001.);
01364 daqBusySummary2_ = dqmStore_->book1D("00 reportSummaryMap_PROCSTAT","DAQ HLT Farm busy (%) from /proc/stat",4000,1,4001.);
01365 daqTotalRateSummary_ = dqmStore_->book1D("00 reportSummaryMap_TOTALRATE","DAQ HLT Farm input rate",4000,1,4001.);
01366
01367 for (size_t i=1;i<=ROLL;i++) {
01368 std::ostringstream ostr;
01369 ostr << i;
01370 rateSummary_->setBinLabel(i,ostr.str(),1);
01371 reportPeriodSummary_->setBinLabel(i,ostr.str(),1);
01372 timingSummary_->setBinLabel(i,ostr.str(),1);
01373 busySummary_->setBinLabel(i,ostr.str(),1);
01374 busySummary2_->setBinLabel(i,ostr.str(),1);
01375 busySummaryUncorr1_->setBinLabel(i,ostr.str(),1);
01376 busySummaryUncorr2_->setBinLabel(i,ostr.str(),1);
01377 fuReportsSummary_->setBinLabel(i,ostr.str(),1);
01378 }
01379 for (size_t i=1;i<epInstances.size()+1;i++) {
01380 std::ostringstream ostr;
01381 ostr << epInstances[i-1];
01382 rateSummary_->setBinLabel(i,ostr.str(),2);
01383 reportPeriodSummary_->setBinLabel(i,ostr.str(),2);
01384 timingSummary_->setBinLabel(i,ostr.str(),2);
01385 busySummary_->setBinLabel(i,ostr.str(),2);
01386 busySummary2_->setBinLabel(i,ostr.str(),2);
01387 busySummaryUncorr1_->setBinLabel(i,ostr.str(),2);
01388 busySummaryUncorr2_->setBinLabel(i,ostr.str(),2);
01389 fuReportsSummary_->setBinLabel(i,ostr.str(),2);
01390 }
01391 rateSummary_->setBinLabel(epInstances.size()+1,"All",2);
01392
01393 busySummary_->setBinLabel(epInstances.size()+1,"%Conf",2);
01394 busySummary_->setBinLabel(epInstances.size()+2,"%Max",2);
01395 busySummary2_->setBinLabel(epInstances.size()+1,"%Conf",2);
01396 busySummary2_->setBinLabel(epInstances.size()+2,"%Max",2);
01397 fuReportsSummary_->setBinLabel(epInstances.size()+1,"All",2);
01398
01399
01400 for (size_t i=0;i<epInstances.size();i++) {
01401 while (lsHistory[i].size()) {
01402 delete lsHistory[i].front();
01403 lsHistory[i].pop_front();
01404 }
01405 }
01406 while (commonLsHistory.size()) {
01407 delete commonLsHistory.front();
01408 commonLsHistory.pop_front();
01409 }
01410 meInitialized_=true;
01411
01412 }
01413
01414 void iDie::initMonitorElementsStreams() {
01415 if (!dqmEnabled_.value_ || !evtProcessor_) return;
01416 if (meInitializedStreams_) return;
01417
01418
01419 endPathRates_.clear();
01420 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Streams/");
01421 for (size_t i=0;i<endPathNames_.size();i++) {
01422 endPathRates_.push_back(dqmStore_->book1D(endPathNames_[i]+"_RATE",endPathNames_[i]+" events/s",4000,1,4001.));
01423 }
01424 meInitializedStreams_=true;
01425 }
01426
01427
01428 void iDie::initMonitorElementsDatasets() {
01429 if (!dqmEnabled_.value_ || !evtProcessor_) return;
01430 if (meInitializedDatasets_) return;
01431
01432
01433 datasetRates_.clear();
01434 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Datasets/");
01435 for (size_t i=0;i<datasetNames_.size();i++) {
01436 datasetRates_.push_back(dqmStore_->book1D(datasetNames_[i]+"_RATE",datasetNames_[i]+" events/s",4000,1,4001.));
01437 }
01438 meInitializedDatasets_=true;
01439 }
01440
01441
01442 void iDie::deleteFramework()
01443 {
01444 if (evtProcessor_) delete evtProcessor_;
01445 }
01446
01447 void iDie::fillDQMStatHist(unsigned int nbsIdx, unsigned int lsid)
01448 {
01449 if (!evtProcessor_ || lsid==0) return;
01450 unsigned int qsize = lsHistory[nbsIdx].size();
01451
01452 unsigned int cqsize = lsHistory[nbsIdx].size();
01453
01454
01455 if (qsize) {
01456 for (int i =(int)qsize-1;i>=0 && i>=(int)qsize-PASTUPDATES;i--) {
01457 unsigned int qpos=(unsigned int) i;
01458 unsigned int forls = lsid - (qsize-1-i);
01459 lsStat * lst = (lsHistory[nbsIdx])[qpos];
01460 unsigned int clsPos = unsigned((int)qpos+ (int)cqsize - (int)qsize);
01461 commonLsStat * clst = commonLsHistory[unsigned((int)qpos+ (int)cqsize - (int)qsize)];
01462
01463 meVecRate_[nbsIdx]->setBinContent(forls,lst->getRatePerMachine());
01464 meVecRate_[nbsIdx]->setBinError(forls,lst->getRateErrPerMachine());
01465 meVecTime_[nbsIdx]->setBinContent(forls>2? forls:0,lst->getEvtTime()*1000);
01466 meVecTime_[nbsIdx]->setBinError(forls>2? forls:0,lst->getEvtTimeErr()*1000);
01467 meVecCPU_[nbsIdx]->setBinContent(forls,lst->getFracBusy()*100.);
01468 meVecCPU_[nbsIdx]->setBinError(forls,0.);
01469 updateRollingHistos(nbsIdx, forls,lst,clst,i==(int)qsize-1);
01470
01471 commonLsStat * prevclst = clsPos>0 ? commonLsHistory[clsPos-1]:nullptr;
01472 updateStreamHistos(forls,clst,prevclst);
01473 updateDatasetHistos(forls,clst,prevclst);
01474 }
01475 }
01476 }
01477
01478 void iDie::updateRollingHistos(unsigned int nbsIdx, unsigned int lsid, lsStat * lst, commonLsStat * clst, bool roll) {
01479 unsigned int lsidBin;
01480 if (roll) {
01481 if (lsid>ROLL) {
01482 lsidBin=ROLL;
01483 if (lsid>summaryLastLs_) {
01484 unsigned int lsdiff = lsid-summaryLastLs_;
01485 for (unsigned int i=1;i<=ROLL;i++) {
01486 if (i<ROLL) {
01487 bool emptyBin=false;
01488 if (i>ROLL-lsdiff) emptyBin=true;
01489 for (unsigned int j=1;j<=epInstances.size()+1;j++) {
01490 rateSummary_->setBinContent(i,j,emptyBin? 0 : rateSummary_->getBinContent(i+lsdiff,j));
01491 reportPeriodSummary_->setBinContent(i,j,emptyBin? 0 : reportPeriodSummary_->getBinContent(i+lsdiff,j));
01492 timingSummary_->setBinContent(i,j,emptyBin ? 0 : timingSummary_->getBinContent(i+lsdiff,j));
01493 busySummary_->setBinContent(i,j,emptyBin ? 0 : busySummary_->getBinContent(i+lsdiff,j));
01494 busySummary2_->setBinContent(i,j,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,j));
01495 busySummaryUncorr1_->setBinContent(i,j,emptyBin ? 0 : busySummaryUncorr1_->getBinContent(i+lsdiff,j));
01496 busySummaryUncorr2_->setBinContent(i,j,emptyBin ? 0 : busySummaryUncorr2_->getBinContent(i+lsdiff,j));
01497 fuReportsSummary_->setBinContent(i,j,emptyBin ? 0 : fuReportsSummary_->getBinContent(i+lsdiff,j));
01498 }
01499 busySummary_->setBinContent(i,epInstances.size()+2,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,epInstances.size()+2));
01500 busySummary2_->setBinContent(i,epInstances.size()+2,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,epInstances.size()+2));
01501 }
01502
01503 std::ostringstream ostr;
01504 ostr << lsid-ROLL+i;
01505 rateSummary_->setBinLabel(i,ostr.str(),1);
01506 reportPeriodSummary_->setBinLabel(i,ostr.str(),1);
01507 timingSummary_->setBinLabel(i,ostr.str(),1);
01508 busySummary_->setBinLabel(i,ostr.str(),1);
01509 busySummary2_->setBinLabel(i,ostr.str(),1);
01510 busySummaryUncorr1_->setBinLabel(i,ostr.str(),1);
01511 busySummaryUncorr2_->setBinLabel(i,ostr.str(),1);
01512 fuReportsSummary_->setBinLabel(i,ostr.str(),1);
01513
01514 }
01515 summaryLastLs_=lsid;
01516 }
01517 else if (lsid<summaryLastLs_) {
01518 if (summaryLastLs_-lsid>=ROLL) return;
01519 lsidBin=ROLL-(summaryLastLs_-lsid);
01520 }
01521 }
01522 else if (lsid) {lsidBin=lsid;summaryLastLs_=lsid;} else return;
01523 }
01524 else {
01525 unsigned int roll_pos = ROLL-(summaryLastLs_-lsid);
01526 lsidBin=lsid > roll_pos ? roll_pos : lsid;
01527 }
01528
01529
01530 float busyCorr = lst->getFracBusy() * (float)epInstances[nbsIdx]/epMax[nbsIdx];
01531
01532 float fracMax = 0.5 + (std::max(epInstances[nbsIdx]-epMax[nbsIdx]/2.,0.)/(epMax[nbsIdx])) *HTscaling[nbsIdx];
01533 if (epInstances[nbsIdx]<epMax[nbsIdx]/2) {
01534 fracMax = epInstances[nbsIdx]/((double)epMax[nbsIdx]);
01535 }
01536
01537
01538 float busyFr=0;
01539 float busyCPUFr=0;
01540 float busyFrTheor=0;
01541 float busyFrCPUTheor=0;
01542
01543
01544 if (busyCorr>0.5) {
01545 busyFr=(0.5 + (busyCorr-0.5)*HTscaling[nbsIdx])/fracMax;
01546 busyFrTheor = (0.5+(busyCorr-0.5)*HTscaling[nbsIdx])/ (0.5+0.5*HTscaling[nbsIdx]);
01547 }
01548 else {
01549 busyFr=busyCorr / fracMax;
01550 busyFrTheor = busyCorr / (0.5+0.5*HTscaling[nbsIdx]);
01551 }
01552
01553
01554 float busyCorr_CPU = lst->getFracCPUBusy();
01555 if (busyCorr_CPU>0.5) {
01556 busyCPUFr=(0.5 + (busyCorr_CPU-0.5)*HTscaling[nbsIdx])/fracMax;
01557 busyFrCPUTheor = (0.5+(busyCorr_CPU-0.5)*HTscaling[nbsIdx])/ (0.5+0.5*HTscaling[nbsIdx]);
01558 }
01559 else {
01560 busyCPUFr=busyCorr_CPU / fracMax;
01561 busyFrCPUTheor = busyCorr_CPU / (0.5+0.5*HTscaling[nbsIdx]);
01562 }
01563
01564
01565 clst->setBusyForClass(nbsIdx,lst->getRate(),busyFr,busyFrTheor,busyCPUFr,busyFrCPUTheor,lst->getReports());
01566 float busyAvg = clst->getBusyTotalFrac(false,machineWeightInst);
01567 float busyAvgCPU = clst->getBusyTotalFrac(true,machineWeightInst);
01568
01569
01570 busyFr=fround(busyFr,0.001f);
01571 busyCPUFr=fround(busyCPUFr,0.001f);
01572 busyFrTheor=fround(busyFrTheor,0.001f);
01573 busyFrCPUTheor=fround(busyFrCPUTheor,0.001f);
01574 busyAvg=fround(busyAvg,0.001f);
01575
01576
01577 if (lsid>2)
01578 while (cpuLoadLastLs_<lsid-2) {
01579 if (cpuLoadLastLs_>=4000-1) break;
01580 cpuLoad_[cpuLoadLastLs_]=daqBusySummary_->getBinContent(cpuLoadLastLs_+1)*0.01;
01581 cpuLoadPS_[cpuLoadLastLs_]=daqBusySummary2_->getBinContent(cpuLoadLastLs_+1)*0.01;
01582 cpuLoadTime7_[cpuLoadLastLs_]=meVecTime_[0]->getBinContent(cpuLoadLastLs_+1)*0.001;
01583 cpuLoadTime8_[cpuLoadLastLs_]=meVecTime_[1]->getBinContent(cpuLoadLastLs_+1)*0.001;
01584 cpuLoadTime12_[cpuLoadLastLs_]=meVecTime_[2]->getBinContent(cpuLoadLastLs_+1)*0.001;
01585 cpuLoadTime16_[cpuLoadLastLs_]=meVecTime_[3]->getBinContent(cpuLoadLastLs_+1)*0.001;
01586 cpuLoadTime24_[cpuLoadLastLs_]=meVecTime_[4]->getBinContent(cpuLoadLastLs_+1)*0.001;
01587 cpuLoadTime32_[cpuLoadLastLs_]=meVecTime_[5]->getBinContent(cpuLoadLastLs_+1)*0.001;
01588 cpuLoadRate_[cpuLoadLastLs_]=daqTotalRateSummary_->getBinContent(cpuLoadLastLs_+1);
01589 cpuLoadRate7_[cpuLoadLastLs_]=meVecRate_[0]->getBinContent(cpuLoadLastLs_+1);
01590 cpuLoadRate8_[cpuLoadLastLs_]=meVecRate_[1]->getBinContent(cpuLoadLastLs_+1);
01591 cpuLoadRate12_[cpuLoadLastLs_]=meVecRate_[2]->getBinContent(cpuLoadLastLs_+1);
01592 cpuLoadRate16_[cpuLoadLastLs_]=meVecRate_[3]->getBinContent(cpuLoadLastLs_+1);
01593 cpuLoadRate24_[cpuLoadLastLs_]=meVecRate_[4]->getBinContent(cpuLoadLastLs_+1);
01594 cpuLoadRate32_[cpuLoadLastLs_]=meVecRate_[5]->getBinContent(cpuLoadLastLs_+1);
01595 unsigned int lsidBinForFlash = lsidBin;
01596 if ((lsid-(cpuLoadLastLs_+1)) < lsidBin) lsidBinForFlash-=lsid-(cpuLoadLastLs_+1);
01597 else lsidBinForFlash=1;
01598 cpuLoadReports7_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,1);
01599 cpuLoadReports8_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,2);
01600 cpuLoadReports12_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,3);
01601 cpuLoadReports16_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,4);
01602 cpuLoadReports24_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,5);
01603 cpuLoadReports32_[cpuLoadLastLs_] = fuReportsSummary_->getBinContent(lsidBinForFlash,6);
01604
01605 cpuLoadUc7_[cpuLoadLastLs_] = meVecCPU_[0]->getBinContent(cpuLoadLastLs_+1)*0.01;
01606 cpuLoadUc8_[cpuLoadLastLs_] = meVecCPU_[1]->getBinContent(cpuLoadLastLs_+1)*0.01;
01607 cpuLoadUc12_[cpuLoadLastLs_] = meVecCPU_[2]->getBinContent(cpuLoadLastLs_+1)*0.01;
01608 cpuLoadUc16_[cpuLoadLastLs_] = meVecCPU_[3]->getBinContent(cpuLoadLastLs_+1)*0.01;
01609 cpuLoadUc24_[cpuLoadLastLs_] = meVecCPU_[4]->getBinContent(cpuLoadLastLs_+1)*0.01;
01610 cpuLoadUc32_[cpuLoadLastLs_] = meVecCPU_[5]->getBinContent(cpuLoadLastLs_+1)*0.01;
01611
01612 cpuLoadLastLs_++;
01613 }
01614
01615
01616 daqBusySummary_->setBinContent(lsid,busyAvg*100.);
01617 daqBusySummary_->setBinError(lsid,0);
01618 daqBusySummary2_->setBinContent(lsid,busyAvgCPU*100.);
01619 daqBusySummary2_->setBinError(lsid,0);
01620
01621 daqTotalRateSummary_->setBinContent(lsid,clst->getTotalRate());
01622 daqTotalRateSummary_->setBinError(lsid,0);
01623
01624
01625 rateSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getRate());
01626 reportPeriodSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getDt());
01627 timingSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getEvtTime()*1000);
01628 fuReportsSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getReports());
01629 busySummary_->setBinContent(lsidBin,nbsIdx+1,fround(busyFr,0.001f));
01630 busySummary2_->setBinContent(lsidBin,nbsIdx+1,fround(busyCPUFr,0.001f));
01631 busySummaryUncorr1_->setBinContent(lsidBin,nbsIdx+1,fround(lst->getFracBusy(),0.001f));
01632 busySummaryUncorr2_->setBinContent(lsidBin,nbsIdx+1,fround(lst->getFracCPUBusy(),0.001f));
01633
01634 rateSummary_->setBinContent(lsidBin,epInstances.size()+1,clst->getTotalRate());
01635 fuReportsSummary_->setBinContent(lsidBin,epInstances.size()+1,clst->getNReports());
01636
01637 busySummary_->setBinContent(lsidBin,epInstances.size()+1,fround(busyAvg,0.001f));
01638 busySummary2_->setBinContent(lsidBin,epInstances.size()+1,fround(busyAvgCPU,0.001f));
01639 busySummary_->setBinContent(lsidBin,epInstances.size()+2,fround(clst->getBusyTotalFracTheor(false,machineWeight),0.001f));
01640 busySummary2_->setBinContent(lsidBin,epInstances.size()+2,fround(clst->getBusyTotalFracTheor(true,machineWeight),0.001f));
01641
01642 }
01643
01644 void iDie::updateStreamHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
01645 {
01646 if (endPathRates_.size()!=endPathNames_.size()) meInitializedStreams_=false;
01647 initMonitorElementsStreams();
01648 for (size_t i=0;i<endPathRates_.size();i++) {
01649 unsigned int count_current=0;
01650 unsigned int count_last=0;
01651 if (clst->endPathCounts_.size()>i) {
01652 count_current=clst->endPathCounts_[i];
01653 }
01654 endPathRates_[i]->setBinContent(forls,(count_current-count_last)/23.1);
01655 }
01656 }
01657
01658
01659 void iDie::updateDatasetHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
01660 {
01661 if (datasetRates_.size()!=datasetNames_.size()) meInitializedDatasets_=false;
01662 initMonitorElementsDatasets();
01663 for (size_t i=0;i<datasetRates_.size();i++) {
01664 unsigned int count_current=0;
01665 unsigned int count_last=0;
01666 if (clst->datasetCounts_.size()>i) {
01667 count_current=clst->datasetCounts_[i];
01668 }
01669 datasetRates_[i]->setBinContent(forls,(count_current-count_last)/23.1);
01670 }
01671 }
01672
01673
01674 void iDie::fillDQMModFractionHist(unsigned int nbsIdx, unsigned int lsid, unsigned int nonIdle, std::vector<std::pair<unsigned int,unsigned int>> offenders)
01675 {
01676 if (!evtProcessor_) return;
01677 MonitorElement * me = meVecOffenders_[nbsIdx];
01678
01679 unsigned int xBinToFill=lsid;
01680 if (lsid>ROLL) {
01681 for (unsigned int i=1;i<=ROLL;i++) {
01682 for (unsigned int j=1;j<=MODNAMES;j++) {
01683 if (i<ROLL)
01684 me->setBinContent(i,j,me->getBinContent(i+1,j));
01685 else
01686 me->setBinContent(i,j,0);
01687 }
01688 std::ostringstream ostr;
01689 ostr << lsid-ROLL+i;
01690 me->setBinLabel(i,ostr.str(),1);
01691 }
01692 std::ostringstream ostr;
01693 ostr << lsid;
01694 xBinToFill=ROLL;
01695 }
01696 float nonIdleInv=0.;
01697 if (nonIdle>0)nonIdleInv=1./(double)nonIdle;
01698
01699 for (unsigned int i=0;i<offenders.size();i++) {
01700 unsigned int x=offenders[i].first;
01701 float percentageUsed=offenders[i].second*nonIdleInv;
01702 if (percentageUsed>0.02) {
01703 if (occupancyNameMap[nbsIdx].count(x)==0) {
01704 unsigned int y=occupancyNameMap[nbsIdx].size();
01705 if (y<MODNAMES) {
01706 (occupancyNameMap[nbsIdx])[x]=y;
01707 me->setBinContent(xBinToFill,y+1,fround(percentageUsed,0.001f));
01708 me->setBinLabel(y+1,mapmod_[x],2);
01709 }
01710 else break;
01711 }
01712 }
01713 }
01714
01715 for (unsigned int i=0;i<offenders.size();i++) {
01716 unsigned int x=offenders[i].first;
01717 float percentageUsed=offenders[i].second*nonIdleInv;
01718 if (percentageUsed>0.02) {
01719 if (occupancyNameMap[nbsIdx].count(x)==0) {
01720 unsigned int y=occupancyNameMap[nbsIdx].size();
01721 if (y>=MODNAMES && xBinToFill>1) {
01722
01723 float minbinval=1.;
01724 unsigned int toReplace=0;
01725 for (size_t j=1;j<=MODNAMES;j++) {
01726
01727 float bin=me->getBinContent(xBinToFill,j);
01728 if (bin<minbinval) {toReplace=j;minbinval=bin;}
01729 }
01730 if (percentageUsed>minbinval && toReplace) {
01731 int key=-1;
01732 for (auto it = occupancyNameMap[nbsIdx].begin(); it != occupancyNameMap[nbsIdx].end(); ++it) {
01733 if (it->second == toReplace-1) {
01734 key = it->first;
01735 break;
01736 }
01737 }
01738 if (key>-1) {
01739
01740 occupancyNameMap[nbsIdx].erase(key);
01741
01742 (occupancyNameMap[nbsIdx])[x]=toReplace-1;
01743
01744 me->setBinContent(xBinToFill,toReplace,fround(percentageUsed,0.001f));
01745 me->setBinLabel(toReplace,mapmod_[x],2);
01746
01747 unsigned qsize = lsHistory[nbsIdx].size();
01748 for (size_t k=1;k<xBinToFill;k++) {
01749 if (xBinToFill-k+1<qsize) {
01750 float fr = (lsHistory[nbsIdx])[qsize-xBinToFill+k-1]->getOffenderFracAt(x);
01751 if (fr>0.02) me->setBinContent(k,toReplace,fround(fr,0.001f));
01752 }
01753 else
01754 me->setBinContent(k,toReplace,0);
01755 }
01756 }
01757 }
01758 }
01759 }
01760 else {
01761 unsigned int y=(occupancyNameMap[nbsIdx])[x];
01762 me->setBinContent(xBinToFill,y+1,fround(percentageUsed,0.001f));
01763 }
01764 }
01765 }
01766 }
01767
01768 void iDie::doFlush() {
01769 if (dqmEnabled_.value_)
01770 dqmService_->flushStandalone();
01771 }
01772
01773 void iDie::timeExpired(toolbox::task::TimerEvent& e)
01774 {
01775
01776 if (debugMode_.value_)
01777 std::cout << "debug - runNumber:" << runNumber_ << " run active:" << runActive_ << std::endl;
01778 if (!runActive_) return;
01779 if (!runNumber_) return;
01780 try
01781 {
01782
01783 if (debugMode_.value_) std::cout << " checking per-lumi flashlist" << std::endl;
01784
01785 if (cpuLoadSentLs_>cpuLoadLastLs_) cpuLoadSentLs_=0;
01786 if (cpuLoadSentLs_<cpuLoadLastLs_ && cpuLoadLastLs_<=4000)
01787 {
01788 unsigned int toSend = cpuLoadLastLs_;
01789 if (toSend) {
01790 toSend--;
01791 cpuInfoSpace_->lock();
01792 if (runNumber_>flashRunNumber_)
01793 flashRunNumber_=runNumber_;
01794 flashLoadLs_=toSend+1;
01795 flashLoad_=cpuLoad_[toSend];
01796 flashLoadPS_=cpuLoadPS_[toSend];
01797 flashLoadTime7_=cpuLoadTime7_[toSend];
01798 flashLoadTime8_=cpuLoadTime8_[toSend];
01799 flashLoadTime12_=cpuLoadTime12_[toSend];
01800 flashLoadTime16_=cpuLoadTime16_[toSend];
01801 flashLoadTime24_=cpuLoadTime24_[toSend];
01802 flashLoadTime32_=cpuLoadTime32_[toSend];
01803 flashLoadRate_=cpuLoadRate_[toSend];
01804
01805 flashLoadRate7_=cpuLoadRate7_[toSend]*cpuLoadReports7_[toSend];
01806 flashLoadRate8_=cpuLoadRate8_[toSend]*cpuLoadReports8_[toSend];
01807 flashLoadRate12_=cpuLoadRate12_[toSend]*cpuLoadReports12_[toSend];
01808 flashLoadRate16_=cpuLoadRate16_[toSend]*cpuLoadReports16_[toSend];
01809 flashLoadRate24_=cpuLoadRate24_[toSend]*cpuLoadReports24_[toSend];
01810 flashLoadRate32_=cpuLoadRate32_[toSend]*cpuLoadReports32_[toSend];
01811
01812 flashLoadUc7_=cpuLoadUc7_[toSend];
01813 flashLoadUc8_=cpuLoadUc8_[toSend];
01814 flashLoadUc12_=cpuLoadUc12_[toSend];
01815 flashLoadUc16_=cpuLoadUc16_[toSend];
01816 flashLoadUc24_=cpuLoadUc24_[toSend];
01817 flashLoadUc32_=cpuLoadUc32_[toSend];
01818
01819 flashReports7_ = cpuLoadReports7_[toSend];
01820 flashReports8_ = cpuLoadReports8_[toSend];
01821 flashReports12_ = cpuLoadReports12_[toSend];
01822 flashReports16_ = cpuLoadReports16_[toSend];
01823 flashReports24_ = cpuLoadReports24_[toSend];
01824 flashReports32_ = cpuLoadReports32_[toSend];
01825
01826 cpuLoadSentLs_++;
01827 cpuInfoSpace_->unlock();
01828 if (cpuLoadSentLs_<=cpuLoadLastLs_) {
01829
01830 if (debugMode_.value_)
01831 std::cout << "debug - updated lumi flashlist with values "
01832 << flashLoadLs_ << " " << flashLoad_ << " " << flashLoadPS_
01833 << " t:" << flashLoadTime7_ << " " << flashLoadTime8_ << " " << flashLoadTime12_ << " "
01834 << flashLoadTime16_ << " " << flashLoadTime24_ << flashLoadTime32_ << " r:" << flashLoadRate_ << std::endl;
01835
01836 cpuInfoSpace_->fireItemGroupChanged(monNames_, this);
01837
01838 }
01839 }
01840 }
01841 }
01842 catch (xdata::exception::Exception& xe)
01843 {
01844 LOG4CPLUS_WARN(getApplicationLogger(), xe.what() );
01845 }
01846 catch (std::exception& se)
01847 {
01848 std::string msg = "Caught standard exception while trying to collect: ";
01849 msg += se.what();
01850 LOG4CPLUS_WARN(getApplicationLogger(), msg );
01851 }
01852 catch (...)
01853 {
01854 std::string msg = "Caught unknown exception while trying to collect";
01855 LOG4CPLUS_WARN(getApplicationLogger(), msg );
01856 }
01857 }
01858
01859 void iDie::perLumiFileSaver(unsigned int lsid)
01860 {
01861
01862
01863 if (lastRunNumberSet_<runNumber_) {
01864 if (meInitialized_) {
01865 std::ostringstream busySummaryTitle;
01866 busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
01867 daqBusySummary_->setTitle(busySummaryTitle.str());
01868 lastRunNumberSet_ = runNumber_.value_;
01869 }
01870 }
01871
01872 if (dqmSaveDir_.value_=="") return;
01873
01874
01875 if (savedForLs_==0)
01876 {
01877 struct stat st;
01878 if (stat((dqmSaveDir_.value_+"/output").c_str(),&st) != 0) {
01879 if (mkdir((dqmSaveDir_.value_+"/output").c_str(), 0777) != 0) {
01880 LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not find nor create DQM \"output\" directory. DQM archiving -> Off.");
01881 dqmSaveDir_.value_="";
01882 return;
01883 }
01884 }
01885 if (stat((dqmSaveDir_.value_+"/done").c_str(),&st) != 0) {
01886 if (mkdir((dqmSaveDir_.value_+"/done").c_str(), 0777) != 0) {
01887 LOG4CPLUS_WARN(getApplicationLogger(),"iDie could not find nor create DQM \"done\" directory. DQM archiving might fail.");
01888 }
01889 }
01890
01891 char version[8];
01892 sprintf(version, "_V%04d_", int(1));
01893 version[7]='\0';
01894 std::string sDir = dqmSaveDir_.value_;
01895 if (sDir[sDir.size()-1]!='/') sDir+="/";
01896 sDir+="output/";
01897 fileBaseName_ = sDir + "DQM" + version;
01898
01899
01900 if ( access( sDir.c_str(), 0 ) == 0 )
01901 {
01902 struct stat status;
01903 stat( sDir.c_str(), &status );
01904
01905 if ( status.st_mode & S_IFDIR ) writeDirectoryPresent_=true;
01906 else writeDirectoryPresent_=false;
01907 }
01908 }
01909
01910 if (lsid > 0 && (lsid%saveLsInterval_.value_)==0 && lsid>savedForLs_ && writeDirectoryPresent_)
01911 {
01912 savedForLs_=lsid;
01913 char suffix[64];
01914 char rewrite[128];
01915 sprintf(suffix, "_R%09d_L%06d", runNumber_.value_, lsid);
01916 sprintf(rewrite, "\\1Run %d/\\2/By Lumi Section %d-%d", runNumber_.value_, ilumiprev_, lsid);
01917
01918 std::vector<std::string> systems = {topLevelFolder_.value_};
01919
01920 for (size_t i = 0, e = systems.size(); i != e; ++i) {
01921 std::string filename = fileBaseName_ + systems[i] + suffix + ".root";
01922 try {
01923 dqmStore_->save(filename, systems[i] , "^(Reference/)?([^/]+)",
01924 rewrite, (DQMStore::SaveReferenceTag) DQMStore::SaveWithReference, dqm::qstatus::STATUS_OK);
01925 pastSavedFiles_.push_back(filename);
01926 if (dqmFilesWritable_.value_)
01927 chmod(filename.c_str(),0777);
01928
01929
01930
01931
01932
01933 }
01934 catch (...) {
01935 LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not create root file " << filename);
01936 }
01937 }
01938
01939 ilumiprev_ = lsid;
01940
01941
01942 if (f_)
01943 f_->cd();
01944 }
01945 }
01946
01947
01948
01949 void iDie::perTimeFileSaver()
01950 {
01951
01952
01953 if (lastRunNumberSet_<runNumber_) {
01954 if (meInitialized_) {
01955 std::ostringstream busySummaryTitle;
01956 busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
01957 daqBusySummary_->setTitle(busySummaryTitle.str());
01958 lastRunNumberSet_ = runNumber_.value_;
01959 }
01960 }
01961
01962 if (dqmSaveDir_.value_=="") return;
01963
01964
01965 std::vector<unsigned int> minutes = {4,8,12,20};
01966
01967
01968
01969 if (!reportingStart_) {
01970 reportingStart_ = new timeval;
01971 gettimeofday(reportingStart_,0);
01972 lastSavedForTime_=0;
01973 return;
01974 }
01975 timeval new_ts;
01976 gettimeofday(&new_ts,0);
01977
01978 unsigned int dT = (new_ts.tv_sec - reportingStart_->tv_sec) / 60;
01979
01980 unsigned int willSaveForTime = 0;
01981
01982 for (size_t i=0;i<minutes.size();i++) {
01983 if (dT>=minutes[i]) {
01984 if (lastSavedForTime_ < minutes[i]) {
01985 willSaveForTime=dT;
01986 lastSavedForTime_=dT;
01987 break;
01988 }
01989 }
01990 }
01991
01992
01993 unsigned int lastMinutesTime = minutes[minutes.size()-1];
01994 if (!willSaveForTime && dT>lastMinutesTime)
01995 {
01996 if (lastSavedForTime_<lastMinutesTime || (dT-lastMinutesTime)/9 > (lastSavedForTime_-lastMinutesTime)/9) {
01997 willSaveForTime=dT;
01998 lastSavedForTime_=dT;
01999 }
02000 }
02001 if (willSaveForTime && writeDirectoryPresent_)
02002 {
02003 char suffix[64];
02004 char rewrite[128];
02005
02006 sprintf(suffix, "_R%09d", runNumber_.value_);
02007 sprintf(rewrite, "\\1Run %d/\\2/Run summary", runNumber_.value_);
02008
02009 std::vector<std::string> systems = {topLevelFolder_.value_};
02010
02011 for (size_t i = 0, e = systems.size(); i != e; ++i) {
02012 std::string filename = fileBaseName_ + systems[i] + suffix + ".root";
02013 try {
02014 dqmStore_->save(filename, systems[i] , "^(Reference/)?([^/]+)",
02015 rewrite, (DQMStore::SaveReferenceTag) DQMStore::SaveWithReference, dqm::qstatus::STATUS_OK);
02016 if (dqmFilesWritable_.value_)
02017 chmod(filename.c_str(),0777);
02018 }
02019 catch (...) {
02020 LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not create root file " << filename);
02021 }
02022 }
02023
02024
02025 if (f_)
02026 f_->cd();
02027 }
02028 }
02029
02030
02031 void iDie::initDQMEventInfo()
02032 {
02033 struct timeval now;
02034 gettimeofday(&now, 0);
02035 double time_now = now.tv_sec + 1e-6*now.tv_usec;
02036
02037 dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
02038 runId_ = dqmStore_->bookInt("iRun");
02039 runId_->Fill(-1);
02040 lumisecId_ = dqmStore_->bookInt("iLumiSection");
02041 lumisecId_->Fill(-1);
02042 eventId_ = dqmStore_->bookInt("iEvent");
02043 eventId_->Fill(-1);
02044 eventTimeStamp_ = dqmStore_->bookFloat("eventTimeStamp");
02045
02046 runStartTimeStamp_ = dqmStore_->bookFloat("runStartTimeStamp");
02047
02048 processTimeStampMe_ = dqmStore_->bookFloat("processTimeStamp");
02049 processTimeStampMe_->Fill(time_now);
02050 processLatencyMe_ = dqmStore_->bookFloat("processLatency");
02051 processLatencyMe_->Fill(-1);
02052 processEventsMe_ = dqmStore_->bookInt("processedEvents");
02053 processEventsMe_->Fill(0);
02054 processEventRateMe_ = dqmStore_->bookFloat("processEventRate");
02055 processEventRateMe_->Fill(-1);
02056 nUpdatesMe_= dqmStore_->bookInt("processUpdates");
02057 nUpdatesMe_->Fill(-1);
02058 processIdMe_= dqmStore_->bookInt("processID");
02059 processIdMe_->Fill(getpid());
02060 processStartTimeStampMe_ = dqmStore_->bookFloat("processStartTimeStamp");
02061 processStartTimeStampMe_->Fill(time_now);
02062 hostNameMe_= dqmStore_->bookString("hostName","cmsidie");
02063 processNameMe_= dqmStore_->bookString("processName","iDie");
02064 workingDirMe_= dqmStore_->bookString("workingDir","/tmp");
02065 cmsswVerMe_= dqmStore_->bookString("CMSSW_Version",edm::getReleaseVersion());
02066 }
02067
02068 void iDie::setRunStartTimeStamp()
02069 {
02070 struct timeval now;
02071 gettimeofday(&now, 0);
02072 double time_now = now.tv_sec + 1e-6*now.tv_usec;
02073 runTS_ = time_now;
02074 }
02075
02077
02079
02080 XDAQ_INSTANTIATOR_IMPL(iDie)