CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
iDie.cc
Go to the documentation of this file.
1 #include "iDie.h"
2 
3 #include "xdaq/NamespaceURI.h"
4 
5 #include "xdata/InfoSpaceFactory.h"
6 #include "toolbox/task/TimerFactory.h"
7 
8 #include "xoap/SOAPEnvelope.h"
9 #include "xoap/SOAPBody.h"
10 #include "xoap/domutils.h"
11 
12 #include <boost/tokenizer.hpp>
13 
14 #include <netinet/in.h>
15 #include <sstream>
16 #include <errno.h>
17 #include <iomanip>
18 #include <algorithm>
19 
20 #include <sys/time.h>
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 //#include <sys/dir.h>
24 #include <time.h>
25 #include <math.h>
26 
27 #include "cgicc/CgiDefs.h"
28 #include "cgicc/Cgicc.h"
29 #include "cgicc/FormEntry.h"
30 #include "cgicc/FormFile.h"
31 #include "cgicc/HTMLClasses.h"
32 
34 
35 //#include "FWCore/PythonParameterSet/interface/MakeParameterSets.h"
36 //#undef HAVE_STAT
44 
46 using namespace evf;
47 
48 #define ROLL 20
49 #define PASTUPDATES 4
50 
52 // construction/destruction
54 
55 //______________________________________________________________________________
56 iDie::iDie(xdaq::ApplicationStub *s)
57  : xdaq::Application(s)
58  , log_(getApplicationLogger())
59  , dqmState_("Null")
60  , instance_(0)
61  , runNumber_(0)
62  , lastRunNumberSet_(0)
63  , runActive_(false)
64  , runTS_(0)
65  , latencyTS_(0)
66  , dqmCollectorHost_()
67  , dqmCollectorPort_()
68  , totalCores_(0)
69  , nstates_(0)
70  , cpustat_(std::vector<std::vector<int> >(0))
71  , last_ls_(0)
72  , f_(0)
73  , t_(0)
74  , b_(0)
75  , b1_(0)
76  , b2_(0)
77  , b3_(0)
78  , b4_(0)
79  , datap_(0)
80  , trppriv_(0)
81  , nModuleLegendaMessageReceived_(0)
82  , nPathLegendaMessageReceived_(0)
83  , nModuleLegendaMessageWithDataReceived_(0)
84  , nPathLegendaMessageWithDataReceived_(0)
85  , nModuleHistoMessageReceived_(0)
86  , nPathHistoMessageReceived_(0)
87  , nDatasetLegendaMessageReceived_(0)
88  , nDatasetLegendaMessageWithDataReceived_(0)
89  , evtProcessor_(0)
90  , meInitialized_(false)
91  , meInitializedStreams_(false)
92  , meInitializedDatasets_(false)
93  , dqmService_(nullptr)
94  , dqmStore_(nullptr)
95  , dqmEnabled_(false)
96  , debugMode_(false)
97  , saveLsInterval_(10)
98  , ilumiprev_(0)
99  , dqmSaveDir_("")
100  , dqmFilesWritable_(true)
101  , topLevelFolder_("DAQ")
102  , savedForLs_(0)
103  , reportingStart_(0)
104  , dsMismatch(0)
105 {
106  // initialize application info
107  url_ =
108  getApplicationDescriptor()->getContextDescriptor()->getURL()+"/"+
109  getApplicationDescriptor()->getURN();
110  class_ =getApplicationDescriptor()->getClassName();
111  instance_=getApplicationDescriptor()->getInstance();
112  hostname_=getApplicationDescriptor()->getContextDescriptor()->getURL();
113  getApplicationDescriptor()->setAttribute("icon", "/evf/images/idieapp.jpg");
114 
115  //soap interface
116  xoap::bind(this,&evf::iDie::fsmCallback,"Configure",XDAQ_NS_URI);
117  xoap::bind(this,&evf::iDie::fsmCallback,"Enable", XDAQ_NS_URI);
118  xoap::bind(this,&evf::iDie::fsmCallback,"Stop", XDAQ_NS_URI);
119  xoap::bind(this,&evf::iDie::fsmCallback,"Halt", XDAQ_NS_URI);
120 
121  // web interface
122  xgi::bind(this,&evf::iDie::defaultWeb, "Default");
123  xgi::bind(this,&evf::iDie::summaryTable, "summary");
124  xgi::bind(this,&evf::iDie::detailsTable, "details");
125  xgi::bind(this,&evf::iDie::dumpTable, "dump" );
126  xgi::bind(this,&evf::iDie::updater, "updater");
127  xgi::bind(this,&evf::iDie::iChoke, "iChoke" );
128  xgi::bind(this,&evf::iDie::iChokeMiniInterface, "iChokeMiniInterface" );
129  xgi::bind(this,&evf::iDie::spotlight, "Spotlight" );
130  xgi::bind(this,&evf::iDie::postEntry, "postEntry");
131  xgi::bind(this,&evf::iDie::postEntryiChoke, "postChoke");
132  // gui_->setSmallAppIcon("/evf/images/Hilton.gif");
133  // gui_->setLargeAppIcon("/evf/images/Hilton.gif");
134 
135  xdata::InfoSpace *ispace = getApplicationInfoSpace();
136  ispace->fireItemAvailable("runNumber", &runNumber_ );
137  getApplicationInfoSpace()->addItemChangedListener("runNumber", this);
138  ispace->fireItemAvailable("dqmCollectorHost", &dqmCollectorHost_ );
139  ispace->fireItemAvailable("dqmCollectorPort", &dqmCollectorPort_ );
140  ispace->fireItemAvailable("saveLsInterval", &saveLsInterval_ );
141  ispace->fireItemAvailable("dqmSaveDir", &dqmSaveDir_ );
142  ispace->fireItemAvailable("dqmFilesWritableByAll", &dqmFilesWritable_ );
143  ispace->fireItemAvailable("dqmTopLevelFolder", &topLevelFolder_ );
144  ispace->fireItemAvailable("dqmEnabled", &dqmEnabled_ );
145  ispace->fireItemAvailable("debugMode", &debugMode_ );
146 
147  // timestamps
155  runStartDetectedTimeStamp_.tv_usec=0;
156 
157  //dqm python configuration
158  configString_= "import FWCore.ParameterSet.Config as cms\n";
159  configString_+="process = cms.Process(\"iDieDQM\")\n";
160  configString_+="process.source = cms.Source(\"EmptySource\")\n";
161  configString_+="process.DQMStore = cms.Service(\"DQMStore\",\n";
162  configString_+=" referenceFileName = cms.untracked.string(''),\n";
163  configString_+=" verbose = cms.untracked.int32(0),\n";
164  configString_+=" verboseQT = cms.untracked.int32(0),\n";
165  configString_+=" collateHistograms = cms.untracked.bool(False))\n";
166  configString_+="process.DQM = cms.Service(\"DQM\",\n";
167  configString_+=" debug = cms.untracked.bool(False),\n";
168  configString_+=" publishFrequency = cms.untracked.double(1.0),\n";
169  configString_+=" collectorPort = cms.untracked.int32(EMPTYPORT),\n";
170  configString_+=" collectorHost = cms.untracked.string('EMPTYHOST'),\n";
171  configString_+=" filter = cms.untracked.string(''),\n";
172  configString_+=" verbose = cms.untracked.bool(False))\n";
173  configString_+="process.p = cms.Path()\n";
174 
175  epInstances = {7, 8, 12, 16, 24, 32};
176  epMax = {8, 8, 24, 32, 24, 32};
177  HTscaling = {1, 1, 0.28,0.28, 0.28,0.28};
178  machineWeight = {91.6, 91.6, 253, 352, 253, 352};
179  machineWeightInst = {80.15,91.6, 196, 275, 253, 352};
180 
181  for (unsigned int i=0;i<epInstances.size();i++) {
182  currentLs_.push_back(0);
184  nbSubsListInv[i]=epInstances[i];
185  std::map<unsigned int, unsigned int> mptmp;
186  occupancyNameMap.push_back(mptmp);
187  }
188  nbSubsClasses = epInstances.size();
189  lsHistory = new std::deque<lsStat*>[nbSubsClasses];
190  //umask for setting permissions of created directories
191 
192  //flashlists
193  flashRunNumber_=0;
194  cpuLoadLastLs_=0;
195  cpuLoadSentLs_=0;
196  std::string cpuInfoSpaceName="filterFarmUsageAndTiming";
197  toolbox::net::URN urn = this->createQualifiedInfoSpace(cpuInfoSpaceName);
198  cpuInfoSpace_ = xdata::getInfoSpaceFactory()->get(urn.toString());
199  cpuInfoSpace_->fireItemAvailable("runNumber",&flashRunNumber_);
200  cpuInfoSpace_->fireItemAvailable("lumiSection",&flashLoadLs_);
201  cpuInfoSpace_->fireItemAvailable("hltCPULoad",&flashLoad_);
202  cpuInfoSpace_->fireItemAvailable("systemCPULoad",&flashLoadPS_);
203  cpuInfoSpace_->fireItemAvailable("eventTime7EP",&flashLoadTime7_);
204  cpuInfoSpace_->fireItemAvailable("eventTime8EP",&flashLoadTime8_);
205  cpuInfoSpace_->fireItemAvailable("eventTime12EP",&flashLoadTime12_);
206  cpuInfoSpace_->fireItemAvailable("eventTime16EP",&flashLoadTime16_);
207  cpuInfoSpace_->fireItemAvailable("eventTime24EP",&flashLoadTime24_);
208  cpuInfoSpace_->fireItemAvailable("eventTime32EP",&flashLoadTime32_);
209 
210  cpuInfoSpace_->fireItemAvailable("hltProcessingRate",&flashLoadRate_);
211 
212  cpuInfoSpace_->fireItemAvailable("hltProcessingRate7EP",&flashLoadRate7_);
213  cpuInfoSpace_->fireItemAvailable("hltProcessingRate8EP",&flashLoadRate8_);
214  cpuInfoSpace_->fireItemAvailable("hltProcessingRate12EP",&flashLoadRate12_);
215  cpuInfoSpace_->fireItemAvailable("hltProcessingRate16EP",&flashLoadRate16_);
216  cpuInfoSpace_->fireItemAvailable("hltProcessingRate24EP",&flashLoadRate24_);
217  cpuInfoSpace_->fireItemAvailable("hltProcessingRate32EP",&flashLoadRate32_);
218 
219  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc7EP",&flashLoadUc7_);
220  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc8EP",&flashLoadUc8_);
221  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc12EP",&flashLoadUc12_);
222  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc16EP",&flashLoadUc16_);
223  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc24EP",&flashLoadUc24_);
224  cpuInfoSpace_->fireItemAvailable("hltCPULoadUc32EP",&flashLoadUc32_);
225 
226  cpuInfoSpace_->fireItemAvailable("numReports7EP", &flashReports7_);
227  cpuInfoSpace_->fireItemAvailable("numReports8EP", &flashReports8_);
228  cpuInfoSpace_->fireItemAvailable("numReports12EP",&flashReports12_);
229  cpuInfoSpace_->fireItemAvailable("numReports16EP",&flashReports16_);
230  cpuInfoSpace_->fireItemAvailable("numReports24EP",&flashReports24_);
231  cpuInfoSpace_->fireItemAvailable("numReports32EP",&flashReports32_);
232 
233  monNames_.push_back("runNumber");
234  monNames_.push_back("lumiSection");
235  monNames_.push_back("hltCPULoad");
236  monNames_.push_back("systemCPULoad");
237  monNames_.push_back("eventTime7EP");
238  monNames_.push_back("eventTime8EP");
239  monNames_.push_back("eventTime12EP");
240  monNames_.push_back("eventTime16EP");
241  monNames_.push_back("eventTime24EP");
242  monNames_.push_back("eventTime32EP");
243 
244  monNames_.push_back("hltProcessingRate");
245  monNames_.push_back("hltProcessingRate7EP");
246  monNames_.push_back("hltProcessingRate8EP");
247  monNames_.push_back("hltProcessingRate12EP");
248  monNames_.push_back("hltProcessingRate16EP");
249  monNames_.push_back("hltProcessingRate24EP");
250  monNames_.push_back("hltProcessingRate32EP");
251 
252  monNames_.push_back("hltCPULoadUc7EP");
253  monNames_.push_back("hltCPULoadUc8EP");
254  monNames_.push_back("hltCPULoadUc12EP");
255  monNames_.push_back("hltCPULoadUc16EP");
256  monNames_.push_back("hltCPULoadUc24EP");
257  monNames_.push_back("hltCPULoadUc32EP");
258 
259  monNames_.push_back("numReports7EP");
260  monNames_.push_back("numReports8EP");
261  monNames_.push_back("numReports12EP");
262  monNames_.push_back("numReports16EP");
263  monNames_.push_back("numReports24EP");
264  monNames_.push_back("numReports32EP");
265 
266  //be permissive for written files
267  umask(000);
268 
269  //start flashlist updater timer
270  try {
271  toolbox::task::Timer * timer = toolbox::task::getTimerFactory()->createTimer("xmas-iDie-updater");
272  toolbox::TimeInterval timerInterval;
273  timerInterval.fromString("PT15S");
274  toolbox::TimeVal timerStart;
275  timerStart = toolbox::TimeVal::gettimeofday();
276  //timer->start();
277  timer->scheduleAtFixedRate( timerStart, this, timerInterval, 0, "xmas-iDie-producer" );
278  }
279  catch (xdaq::exception::Exception& e) {
280  LOG4CPLUS_WARN(getApplicationLogger(), e.what());
281  }
282 }
283 
284 
285 //______________________________________________________________________________
287 {
288 }
289 
290 //______________________________________________________________________________
291 void iDie::actionPerformed(xdata::Event& e)
292 {
293 
294  if (e.type()=="ItemChangedEvent" ) {
295  std::string item = dynamic_cast<xdata::ItemChangedEvent&>(e).itemName();
296 
297  if ( item == "runNumber") {
298  LOG4CPLUS_WARN(getApplicationLogger(),
299  "New Run was started - iDie will reset");
300  reset();
301  runActive_=true;
303 
304  dqmState_ = "Prepared";
305  if (dqmEnabled_.value_) {
308  doFlush();
309  }
310  }
311 
312  }
313 }
314 
315 //______________________________________________________________________________
316 xoap::MessageReference iDie::fsmCallback(xoap::MessageReference msg)
318 {
319 
320  xoap::SOAPPart part =msg->getSOAPPart();
321  xoap::SOAPEnvelope env =part.getEnvelope();
322  xoap::SOAPBody body =env.getBody();
323  DOMNode *node =body.getDOMNode();
324  DOMNodeList *bodyList=node->getChildNodes();
325  DOMNode *command =0;
326  std::string commandName;
327 
328  for (unsigned int i=0;i<bodyList->getLength();i++) {
329  command = bodyList->item(i);
330  if(command->getNodeType() == DOMNode::ELEMENT_NODE) {
331  commandName = xoap::XMLCh2String(command->getLocalName());
332  break;
333  }
334  }
335 
336  if (commandName.empty()) {
337  XCEPT_RAISE(xoap::exception::Exception,"Command not found.");
338  }
339 
340  // fire appropriate event and create according response message
341  try {
342 
343  // response string
344  xoap::MessageReference reply = xoap::createMessage();
345  xoap::SOAPEnvelope envelope = reply->getSOAPPart().getEnvelope();
346  xoap::SOAPName responseName = envelope.createName(commandName+"Response",
347  "xdaq",XDAQ_NS_URI);
348  xoap::SOAPBodyElement responseElem =
349  envelope.getBody().addBodyElement(responseName);
350 
351  // generate correct return state string
352  std::string state;
353  if(commandName == "Configure") {dqmState_ = "Ready"; state = "Ready";}
354  else if(commandName == "Enable" || commandName == "Start") {
355  dqmState_ = "Enabled"; state = "Enabled";
356  setRunStartTimeStamp();
357 
358  }
359  else if(commandName == "Stop" || commandName == "Halt") {
360  runActive_=false;
361  //EventInfo:reset timestamps
362  runTS_=0.;
363  latencyTS_=0;
364  //cleanup flashlist data
365  cpuLoadLastLs_=0;
366  cpuLoadSentLs_=0;
367  //remove histograms
368  std::cout << " Stopping/Halting iDie. command=" << commandName << " initialized=" << meInitialized_ << std::endl;
369  if (meInitialized_) {
370  dqmState_ = "Removed";
371  usleep(10000);//propagating dqmState to caches
372  meInitialized_=false;
373  meInitializedStreams_=false;
374  meInitializedDatasets_=false;
375  sleep(1);//making sure that any running ls update finishes
376 
377  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Streams/");
378  dqmStore_->removeContents();
379  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Datasets/");
380  dqmStore_->removeContents();
381  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Modules/");
382  dqmStore_->removeContents();
383  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Tables/");
384  dqmStore_->removeContents();
385  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
386  dqmStore_->removeContents();
387  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
388  dqmStore_->removeContents();
389  doFlush();
390  }
391  if (reportingStart_) delete reportingStart_;
392  reportingStart_=0;
393  state = "Ready";
394  }
395  //else if(commandName == "Halt") state = "Halted";
396  else state = "BOH";
397 
398  xoap::SOAPName stateName = envelope.createName("state",
399  "xdaq",XDAQ_NS_URI);
400  xoap::SOAPElement stateElem = responseElem.addChildElement(stateName);
401  xoap::SOAPName attributeName = envelope.createName("stateName",
402  "xdaq",XDAQ_NS_URI);
403  stateElem.addAttribute(attributeName,state);
404 
405  return reply;
406  }
408  XCEPT_RETHROW(xoap::exception::Exception,"invalid command.",e);
409  }
410 
411 
412 
413 }
414 
415 //______________________________________________________________________________
418 {
419  cgicc::Cgicc cgi(in);
420  std::string method = cgi.getEnvironment().getRequestMethod();
421  if(method == "POST"){
422  unsigned int run = 0;
423  std::vector<cgicc::FormEntry> el1 = cgi.getElements();
424  cgi.getElement("run",el1);
425  if(el1.size()!=0){
426  run = el1[0].getIntegerValue();
427  if(run > runNumber_.value_ || runNumber_.value_==0){
428  runNumber_.value_ = run;
429  runActive_=true;
430  if(runNumber_.value_!=0)
431  {
432  reset();
433  if(f_ == 0)
434  {
435  std::ostringstream ost;
436  ost << "microReport"<<runNumber_<<".root";
437  f_ = new TFile(ost.str().c_str(),"RECREATE","microreport");
438  }
439  }
440  }
441  }
442  internal::fu fuinstance;
443 
444  fuinstance.ccount = 0;
445  std::string hostname = cgi.getEnvironment().getRemoteHost();
446  std::transform(hostname.begin(), hostname.end(),
447  hostname.begin(), ::toupper);
448  fus_[hostname] = fuinstance;
449  }
450  else{
451  *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
452  << "<html><head><title>" << getApplicationDescriptor()->getClassName()
453  << getApplicationDescriptor()->getInstance() << "</title>"
454  << "<meta http-equiv=\"REFRESH\" content=\"0;url=/evf/html/idiePage.html\">"
455  << "</head></html>";
456  }
457 }
458 
459 //______________________________________________________________________________
462 {
463  *out << runNumber_.value_ << std::endl;
464 }
465 //______________________________________________________________________________
468 {
469  *out << "<tr><td>"<<fus_.size()<<"</td><td>" << totalCores_
470  << "</td><td></td></tr>" << std::endl;
471 }
472 
473 //______________________________________________________________________________
476 {
477  timeval tv;
478  gettimeofday(&tv,0);
479  time_t now = tv.tv_sec;
480  for(ifmap i = fus_.begin(); i != fus_.end(); i++)
481  if((*i).second.ccount != 0){
482  *out << "<tr><td "
483  << (now-(*i).second.tstamp<300 ? "style=\"background-color:red\"" : "")
484  << ">"<<(*i).first<<"</td><td>"
485  << (*i).second.ccount << "</td>"
486  << "<td onClick=loaddump(\'" << url_.value_ << "/dump?name="
487  << (*i).first << "\')>" << (*i).second.cpids.back()
488  << "</td><td>" <<(*i).second.signals.back()
489  << "</td></tr>" << std::endl;
490  }
491 }
492 
493 //______________________________________________________________________________
496 {
497  cgicc::Cgicc cgi(in);
498 
499  std::vector<cgicc::FormEntry> el1;
500  cgi.getElement("name",el1);
501  if(el1.size()!=0){
502  std::string hostname = el1[0].getValue();
503  std::transform(hostname.begin(), hostname.end(),
504  hostname.begin(), ::toupper);
505  ifmap fi = fus_.find(hostname);
506  if(fi!=fus_.end()){
507  *out << (*fi).second.stacktraces.back() << std::endl;
508  }
509  else{
510  for(fi=fus_.begin(); fi != fus_.end(); fi++)
511  std::cout << "known hosts: " << (*fi).first << std::endl;
512  }
513  }
514 }
515 
516 //______________________________________________________________________________
519 {
520  unsigned int i = 0;
521 
522  if(last_ls_==0) return; //wait until at least one complete cycle so we have all arrays sized correctly !!!
523  *out << "<div id=\"cls\">" << last_ls_ << "</div>"
524  << "<div id=\"clr\">" << cpuentries_[last_ls_-1] << "</div>" << std::endl;
525  sorted_indices tmp(cpustat_[last_ls_-1]);
526  // std::sort(tmp.begin(),tmp.end());// figure out how to remap indices of legenda
527  *out << "<tbody id=\"cpue\">";
528  while(i<nstates_){
529  if(tmp[i]!=0) *out << "<tr><td>" << mapmod_[tmp.ii(i)] << "</td>" << "<td>"
530  << float(tmp[i])/float(cpuentries_[last_ls_-1]) << "</td></tr>";
531  i++;
532  }
533  *out << "</tbody>\n";
534  *out << "<tbody id=\"cpui\"><tr><td></td>";
535  unsigned int begin = last_ls_<5 ? 0 : last_ls_-5;
536  for(i=begin; i < last_ls_; i++)
537  *out << "<td>" << i +1 << "</td>";
538  *out << "</tr><tr><td></td>";
539  for(i=begin; i < last_ls_; i++)
540  *out << "<td>" << float(cpustat_[i][2])/float(cpuentries_[i]) << "</td>";
541  *out << "</tr></tbody>\n";
542 
543  *out << "<tbody id=\"rate\"><tr><td></td>";
544  begin = last_ls_<5 ? 0 : last_ls_-5;
545  for(i=begin; i < last_ls_; i++)
546  *out << "<td>" << float(trp_[i].eventSummary.totalEventsPassed)/float(trp_[i].eventSummary.totalEvents) << "</td>";
547  *out << "</tr>\n<tr><td></td>";
548  for(i=begin; i < last_ls_; i++)
549  *out << "<td>" << trp_[i].eventSummary.totalEvents << "</td>";
550  *out << "</tr>\n<tr><td></td>";
551  for(int j = 0; j < trp_[0].trigPathsInMenu; j++)
552  {
553  *out << "<tr><td></td>";
554  for(i=begin; i < last_ls_; i++)
555  *out << "<td>" << trp_[i].trigPathSummaries[j].timesPassed << "("
556  << trp_[i].trigPathSummaries[j].timesPassedL1 << ")("
557  << trp_[i].trigPathSummaries[j].timesPassedPs << ")</td>";
558  *out << "<td>" << mappath_[j] << "</td>";
559  *out << "</tr>\n";
560  }
561  for(int j = 0; j < trp_[0].endPathsInMenu; j++)
562  {
563  *out << "<tr><td></td>";
564  for(i=begin; i < last_ls_; i++)
565  *out << "<td>" << trp_[i].endPathSummaries[j].timesPassed << "</td>";
566  *out << "<td>" << mappath_[j+trp_[last_ls_-1].trigPathsInMenu] << "</td>";
567  *out << "</tr>\n";
568  }
569  *out << "</tbody>\n";
570 }
571 
572 //______________________________________________________________________________
575 {
576  *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
577  << "<html><head><title>" << getApplicationDescriptor()->getClassName()
578  << getApplicationDescriptor()->getInstance() << "</title>"
579  << "<meta http-equiv=\"REFRESH\" content=\"0;url=/evf/html/ichokePage.html\">"
580  << "</head></html>";
581 
582 
583 
584 }
585 
586 //______________________________________________________________________________
589 {
590 
591  timeval tv;
592  gettimeofday(&tv,0);
593  time_t now = tv.tv_sec;
594 
595  try {
596  cgicc::Cgicc cgi(in);
597  unsigned int run = 0;
598  pid_t cpid = 0;
599  /* cgicc::CgiEnvironment cgie(in);
600  cout << "query = " << cgie.getContentLength() << endl;
601  */
602  std::vector<cgicc::FormEntry> el1;
603  el1 = cgi.getElements();
604  // for(unsigned int i = 0; i < el1.size(); i++)
605  // std::cout << "name="<<el1[i].getName() << std::endl;
606  el1.clear();
607  cgi.getElement("run",el1);
608  if(el1.size()!=0)
609  {
610  run = el1[0].getIntegerValue();
611  }
612  el1.clear();
613  cgi.getElement("stacktrace",el1);
614  if(el1.size()!=0)
615  {
616  cpid = run;
617  // std::cout << "=============== stacktrace =============" << std::endl;
618  // std::cout << el1[0].getValue() << std::endl;
619  if(el1[0].getValue().find("Dead")==0){
620 
621  std::string host = cgi.getEnvironment().getRemoteHost();
622  std::transform(host.begin(), host.end(),
623  host.begin(), ::toupper);
624  ifmap fi = fus_.find(host);
625  if(fi!=fus_.end()){
626  fus_.erase(fi);
627  }
628  if(fus_.size()==0) { //close the root file if we know the run is over
629 
630  if(f_!=0){
631  f_->cd();
632  f_->Write();
633  }
634  if(t_ != 0) {
635  delete t_;
636  t_ = 0;
637  }
638  if(f_!=0){
639  f_->Close();
640  delete f_; f_ = 0;
641  }
642  }
643  }
644  else{
645  totalCores_++;
646  std::string st = el1[0].getValue();
647  std::string sig;
648  size_t psig = st.find("signal");
649  if(psig != std::string::npos)
650  sig = st.substr(psig,9);
651  std::string host = cgi.getEnvironment().getRemoteHost();
652  std::transform(host.begin(), host.end(),
653  host.begin(), ::toupper);
654  ifmap fi = fus_.find(host);
655  if(fi!=fus_.end()){
656  (*fi).second.tstamp = now;
657  (*fi).second.ccount++;
658  (*fi).second.cpids.push_back(cpid);
659  (*fi).second.signals.push_back(sig);
660  (*fi).second.stacktraces.push_back(st);
661  }
662  }
663  }
664  el1.clear();
665  cgi.getElement("legenda",el1);
666  if(el1.size()!=0)
667  {
668  parsePathLegenda(el1[0].getValue());
669  }
670  cgi.getElement("LegendaAux",el1);
671  if (el1.size()!=0)
672  {
673  parseDatasetLegenda(el1[0].getValue());
674  }
675  cgi.getElement("trp",el1);
676  if(el1.size()!=0)
677  {
678  unsigned int lsid = run;
679  parsePathHisto((unsigned char*)(el1[0].getValue().c_str()),lsid);
680  }
681  el1.clear();
682  }
683  catch (edm::Exception &e) {
684  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught edm exception in postEntry: " << e.what());
685  }
686  catch (cms::Exception &e) {
687  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught cms exception in postEntry: " << e.what());
688  }
689  catch (std::exception &e) {
690  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught std exception in postEntry: " << e.what());
691  }
692  catch (...) {
693  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught unknown exception in postEntry");
694  }
695 
696 }
697 
698 //______________________________________________________________________________
701 {
702  // std::cout << "postEntryiChoke " << std::endl;
703 
704  if (dqmEnabled_.value_) {
705  if (!evtProcessor_) initFramework();
706  if (!meInitialized_) {
707  if (dqmState_!="Removed") initMonitorElements();
708  }
709  }
710 
711 
712  unsigned int lsid = 0;
713  try {
714  cgicc::Cgicc cgi(in);
715  /* cgicc::CgiEnvironment cgie(in);
716  cout << "query = " << cgie.getContentLength() << endl;
717  */
718  std::vector<cgicc::FormEntry> el1;
719  el1 = cgi.getElements();
720  // for(unsigned int i = 0; i < el1.size(); i++)
721  // std::cout << "name="<<el1[i].getName() << std::endl;
722  el1.clear();
723  cgi.getElement("run",el1);
724  if(el1.size()!=0)
725  {
726  lsid = el1[0].getIntegerValue();
727  }
728  el1.clear();
729 
730  //with the first message for the new lsid, resize all containers so
731  // a web access won't address an invalid location in case it interleaves between
732  // the first cpustat update and the first scalers update or viceversa
733  if(lsid!=0){
734  if(lsid>cpustat_.size()){
735  cpustat_.resize(lsid,std::vector<int>(nstates_,0));
736  cpuentries_.resize(lsid,0);
737  }
738  if(lsid>trp_.size()){
739  trp_.resize(lsid);
740  funcs::reset(&trp_[lsid-1]);
741  trpentries_.resize(lsid,0);
742  }
743  if(last_ls_ < lsid) {
744  last_ls_ = lsid;
745  funcs::reset(&trp_[lsid-1]);
746  if(t_ && (last_ls_%10==0)) t_->Write();
747  }
748  }
749 
750  cgi.getElement("legenda",el1);
751  if(el1.size()!=0)
752  {
753  parseModuleLegenda(el1[0].getValue());
754  }
755  cgi.getElement("trp",el1);
756  if(el1.size()!=0)
757  {
758  parseModuleHisto(el1[0].getValue().c_str(),lsid);
759  }
760  el1.clear();
761  }
762 
763  catch (edm::Exception &e) {
764  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught edm exception in postEntryiChoke: " << e.what());
765  }
766  catch (cms::Exception &e) {
767  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught cms exception in postEntryiChoke: " << e.what());
768  }
769  catch (std::exception &e) {
770  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught std exception in postEntryiChoke: " << e.what());
771  }
772  catch (...) {
773  LOG4CPLUS_ERROR(getApplicationLogger(),"Caught unknown exception in postEntryiChoke");
774  }
775 }
776 
777 
779 {
780  fus_.erase(fus_.begin(),fus_.end());
781  totalCores_=0;
782  last_ls_ = 0;
783  trp_.clear();
784  trpentries_.clear();
785  cpustat_.clear();
786  cpuentries_.clear();
787 
788  if(f_!=0){
789  f_->cd();
790  f_->Write();
791  }
792 
793  if(t_ != 0)
794  {
795  delete t_; t_=0;
796  }
797 
798  if(f_!=0){
799  f_->Close();
800  delete f_; f_ = 0;
801  }
802  if(datap_ != 0)
803  {delete datap_; datap_ = 0;}
804  b_=0; b1_=0; b2_=0; b3_=0; b4_=0;
805 
806 }
807 
808 void iDie::parseModuleLegenda(std::string leg)
809 {
811  if(leg=="") return;
812  gettimeofday(&lastModuleLegendaMessageTimeStamp_,0);
814  mapmod_.clear();
815  // if(cpustat_) delete cpustat_;
816  boost::char_separator<char> sep(",");
817  boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
818  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
819  tok_iter != tokens.end(); ++tok_iter){
820  mapmod_.push_back((*tok_iter));
821  }
822  nstates_ = mapmod_.size();
823  // cpustat_ = new int[nstates_];
824 // for(int i = 0; i < nstates_; i++)
825 // cpustat_[i]=0;
826 // cpuentries_ = 0;
827 }
828 
829 void iDie::parseModuleHisto(const char *crp, unsigned int lsid)
830 {
831  if(lsid==0) return;
833  int *trp = (int*)crp;
834  if(t_==0 && f_!=0){
835  datap_ = new int[nstates_+5];
836  std::ostringstream ost;
837  ost<<mapmod_[0]<<"/I";
838  for(unsigned int i = 1; i < nstates_; i++)
839  ost<<":"<<mapmod_[i];
840  ost<<":nsubp:instance:nproc:ncpubusy";//
841  f_->cd();
842  t_ = new TTree("microReport","microstate report tree");
843  t_->SetAutoSave(500000);
844  b_ = t_->Branch("microstates",datap_,ost.str().c_str());
845  b1_ = t_->Branch("ls",&lsid,"ls/I");
846 
847  }
848 
849  memcpy(datap_,trp,(nstates_+5)*sizeof(int));
850  //check ls for subprocess type
851  unsigned int datapLen_ = nstates_+5;
852  unsigned int nbsubs_ = datap_[datapLen_-5];
853  unsigned int nbproc_ = datap_[datapLen_-3];
854  unsigned int ncpubusy_ = datap_[datapLen_-2];
855  unsigned int deltaTms_ = datap_[datapLen_-1];
856 
857  //find index number
858  int nbsIdx = -1;
859 
860  /* debugging test
861  unsigned int randls = 0;
862  unsigned int randslot = 0;
863  if (lsid>3) {
864  randslot = rand();
865  if (randslot%2) nbsubs_=7;
866  else nbsubs_=8;
867  randls = rand();
868  randls%=3;
869  lsid-=randls;
870  }
871  */
872 
873  if (meInitialized_ && nbSubsList.find(nbsubs_)!=nbSubsList.end() && lsid) {
874  nbsIdx = nbSubsList[nbsubs_];
875  if (currentLs_[nbsIdx]<lsid) {//new lumisection for this ep class
876  if (currentLs_[nbsIdx]!=0) {
877  if (lsHistory[nbsIdx].size()) {
878 
879  //refresh run/lumi number and timestamp
880  runId_->Fill(runNumber_.value_);
881  lumisecId_->Fill(currentLs_[nbsIdx]);
882  struct timeval now;
883  gettimeofday(&now, 0);
884  double time_now = now.tv_sec + 1e-6*now.tv_usec;
885  eventTimeStamp_->Fill( time_now );
886 
887  //check if run timestamp is set
888  double runTS = runTS_;
889  if (runTS==0.)
890  runTS_ = time_now;
891 
892  runStartTimeStamp_->Fill(runTS);
893 
894  processLatencyMe_->Fill(time_now-latencyTS_);
895  latencyTS_=time_now;
896  processTimeStampMe_->Fill(time_now);
897 
898  //do histogram updates for the lumi
899  lsStat * lst = lsHistory[nbsIdx].back();
900  fillDQMStatHist(nbsIdx,currentLs_[nbsIdx]);
902  lst->getOffendersVector());
903  doFlush();
904  perLumiFileSaver(currentLs_[nbsIdx]);
906  }
907  }
908 
909  currentLs_[nbsIdx]=lsid;
910 
911  //add elements for new lumisection, fill the gap if needed
912  unsigned int lclast = commonLsHistory.size() ? commonLsHistory.back()->ls_:0;
913  for (unsigned int newls=lclast+1;newls<=lsid;newls++) {
914  commonLsHistory.push_back(new commonLsStat(newls,epInstances.size()));
915  }
916 
917  unsigned int lhlast = lsHistory[nbsIdx].size() ? lsHistory[nbsIdx].back()->ls_:0;
918  for (size_t newls=lhlast+1;newls<=lsid;newls++) {
919  lsHistory[nbsIdx].push_back(new lsStat(newls,nbsubs_,nModuleLegendaMessageReceived_,nstates_));
920  }
921 
922  //remove old elements from queues
923  while (commonLsHistory.size()>ROLL) {delete commonLsHistory.front(); commonLsHistory.pop_front();}
924  while (lsHistory[nbsIdx].size()>ROLL) {delete lsHistory[nbsIdx].front(); lsHistory[nbsIdx].pop_front();}
925  }
926  if (currentLs_[nbsIdx]>=lsid) { // update for current or previous lumis
927  unsigned int qsize=lsHistory[nbsIdx].size();
928  unsigned int delta = currentLs_[nbsIdx]-lsid;
929  if (qsize>delta && delta<ROLL) {
930  lsStat * lst = (lsHistory[nbsIdx])[qsize-delta-1];
931  unsigned int cumulative_ = 0;
932  auto fillvec = lst->getModuleSamplingPtr();
933  for (unsigned int i=0;i<nstates_;i++) {
934  cumulative_+=datap_[i];
935  if (fillvec) {
936  fillvec[i].second+=datap_[i];
937  }
938  }
939  unsigned int busyCounts = cumulative_-datap_[2];
940  lst->update(busyCounts,datap_[2],nbproc_,ncpubusy_,deltaTms_);
941  }
942  }
943  }
944  else {
945  //no predefined plots for this number of sub processes
946  }
947 
948  if(t_!=0){
949  t_->SetEntries(t_->GetEntries()+1); b_->Fill(); b1_->Fill();
950  }
951 
952  for(unsigned int i=0;i<nstates_; i++)
953  {
954  cpustat_[lsid-1][i] += trp[i];
955  cpuentries_[lsid-1] += trp[i];
956  }
957 }
958 
959 
960 void iDie::parsePathLegenda(std::string leg)
961 {
963  if(leg=="")return;
964  gettimeofday(&lastPathLegendaMessageTimeStamp_,0);
966  mappath_.clear();
967  boost::char_separator<char> sep(",");
968  boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
969  endPathNames_.clear();
970  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
971  tok_iter != tokens.end(); ++tok_iter){
972  mappath_.push_back((*tok_iter));
973 
974  if (std::string(*tok_iter).find("Output")!=std::string::npos) {
975  std::string path_token = *tok_iter;
976  if (path_token.find("=")!=std::string::npos)
977  endPathNames_.push_back(path_token.substr(path_token.find("=")+1));
978  else
979  endPathNames_.push_back(*tok_iter);
980  }
981  }
982  //look for daqval-type menu if no "Output" endpaths found
983  if (!endPathNames_.size()) {
984 
985  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
986  tok_iter != tokens.end(); ++tok_iter){
987 
988  if (std::string(*tok_iter).find("output")!=std::string::npos) {
989  std::string path_token = *tok_iter;
990  if (path_token.find("=")!=std::string::npos)
991  endPathNames_.push_back(path_token.substr(path_token.find("=")+1));
992  else
993  endPathNames_.push_back(*tok_iter);
994  }
995  }
996  }
997 }
998 
1000 {
1002  datasetNames_.clear();
1003  dsMismatch=0;
1004  if(leg=="")return;
1005  gettimeofday(&lastDatasetLegendaMessageTimeStamp_,0);
1007  try {
1008  boost::char_separator<char> sep(",");
1009  boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
1010  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
1011  tok_iter != tokens.end(); ++tok_iter) {
1012  datasetNames_.push_back((*tok_iter));
1013  }
1014  }
1015  catch (...) {}
1016 }
1017 
1018 void iDie::parsePathHisto(const unsigned char *crp, unsigned int lsid)
1019 {
1020  if(lsid==0) return;
1022 // if(lsid>=trp_.size()){
1023 // trp_.resize(lsid);
1024 // funcs::reset(&trp_[lsid-1]);
1025 // trpentries_.resize(lsid,0);
1026 // }
1027  trppriv_ = (TriggerReportStatic*)crp;
1028  for( int i=0; i< trppriv_->trigPathsInMenu; i++)
1029  {
1036  }
1037  //find |common ls history" object for current ls
1038  commonLsStat * cst = 0;
1039  if (meInitialized_) {
1040  if (commonLsHistory.size()) cst=commonLsHistory.back();
1041  if (cst && cst->ls_>=lsid) {
1042  unsigned int countback=commonLsHistory.size()-1;
1043  while (cst->ls_>lsid && countback) {
1044  countback--;
1045  cst=commonLsHistory[countback];
1046  }
1047  }
1048  }
1049 
1050  for( int i=0; i< trppriv_->endPathsInMenu; i++)
1051  {
1058  if (cst) {
1059  if ((unsigned)i < cst->endPathCounts_.size()) cst->endPathCounts_[i]+=r_.etimesPassed[i];
1060  else cst->endPathCounts_.push_back(r_.etimesPassed[i]);
1061  }
1062  }
1063 
1064  //mismatch in expected and reported dataset number
1065  if (trppriv_->datasetsInMenu!=(int)datasetNames_.size())
1066  {
1067  dsMismatch++;
1068  if (!(dsMismatch%100) || dsMismatch<10) {
1069  LOG4CPLUS_WARN(getApplicationLogger(),"mismatch in number of datasets! "
1070  << trppriv_->datasetsInMenu << " in report, " << datasetNames_.size()
1071  << " from legend! received legends:"<< nDatasetLegendaMessageWithDataReceived_);
1072  }
1073  }
1074 
1075  for( int i=0; i< trppriv_->datasetsInMenu; i++)
1076  {
1077  if (cst) {
1078  if ((unsigned)i < cst->datasetCounts_.size()) cst->datasetCounts_[i]+=trppriv_->datasetSummaries[i].timesPassed;
1079  else cst->datasetCounts_.push_back(trppriv_->datasetSummaries[i].timesPassed);
1080  }
1081  }
1082 
1086 
1087 
1088  if(t_!=0 && f_!=0 && b2_==0){
1089 
1090  b2_ = t_->Branch("rate",&r_,"nproc/I:nsub:nrep");
1091  std::ostringstream ost1;
1092  ost1 << "p_nrun[" << trppriv_->trigPathsInMenu
1093  << "]/I:p_npps[" << trppriv_->trigPathsInMenu
1094  << "]:p_npl1[" << trppriv_->trigPathsInMenu
1095  << "]:p_npp[" << trppriv_->trigPathsInMenu
1096  << "]:p_npf[" << trppriv_->trigPathsInMenu
1097  << "]:p_npe[" << trppriv_->trigPathsInMenu <<"]";
1098 
1099  b3_ = t_->Branch("paths",r_.ptimesRun,ost1.str().c_str());
1100  std::ostringstream ost2;
1101  ost2 << "ep_nrun[" << trppriv_->endPathsInMenu
1102  << "]/I:en_npps[" << trppriv_->endPathsInMenu
1103  << "]:ep_npl1[" << trppriv_->endPathsInMenu
1104  << "]:ep_npp[" << trppriv_->endPathsInMenu
1105  << "]:ep_npf[" << trppriv_->endPathsInMenu
1106  << "]:ep_npe[" << trppriv_->endPathsInMenu << "]";
1107  b4_ = t_->Branch("endpaths",r_.etimesRun,ost2.str().c_str());
1108  }
1109  if(b2_!=0) b2_->Fill();
1110  if(b3_!=0) b3_->Fill();
1111  if(b4_!=0) b4_->Fill();
1112 
1113  funcs::addToReport(&trp_[lsid-1],trppriv_,lsid);
1114  trpentries_[lsid-1]++;
1115 
1116 }
1117 
1118 // web pages
1119 
1122 {
1123 
1124  std::string urn = getApplicationDescriptor()->getURN();
1125 
1126  *out << "<!-- base href=\"/" << urn
1127  << "\"> -->" << std::endl;
1128  *out << "<html>" << std::endl;
1129  *out << "<head>" << std::endl;
1130  *out << "<link type=\"text/css\" rel=\"stylesheet\"";
1131  *out << " href=\"/evf/html/styles.css\"/>" << std::endl;
1132  *out << "<title>" << getApplicationDescriptor()->getClassName()
1133  << getApplicationDescriptor()->getInstance()
1134  << " MAIN</title>" << std::endl;
1135  *out << "</head>" << std::endl;
1136  *out << "<body>" << std::endl;
1137  *out << "<table border=\"0\" width=\"100%\">" << std::endl;
1138  *out << "<tr>" << std::endl;
1139  *out << " <td align=\"left\">" << std::endl;
1140  *out << " <img" << std::endl;
1141  *out << " align=\"middle\"" << std::endl;
1142  *out << " src=\"/evf/images/spoticon.jpg\"" << std::endl;
1143  *out << " alt=\"main\"" << std::endl;
1144  *out << " width=\"64\"" << std::endl;
1145  *out << " height=\"64\"" << std::endl;
1146  *out << " border=\"\"/>" << std::endl;
1147  *out << " <b>" << std::endl;
1148  *out << getApplicationDescriptor()->getClassName()
1149  << getApplicationDescriptor()->getInstance() << std::endl;
1150  *out << " </b>" << std::endl;
1151  *out << " </td>" << std::endl;
1152  *out << " <td width=\"32\">" << std::endl;
1153  *out << " <a href=\"/urn:xdaq-application:lid=3\">" << std::endl;
1154  *out << " <img" << std::endl;
1155  *out << " align=\"middle\"" << std::endl;
1156  *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << std::endl;
1157  *out << " alt=\"HyperDAQ\"" << std::endl;
1158  *out << " width=\"32\"" << std::endl;
1159  *out << " height=\"32\"" << std::endl;
1160  *out << " border=\"\"/>" << std::endl;
1161  *out << " </a>" << std::endl;
1162  *out << " </td>" << std::endl;
1163  *out << " <td width=\"32\">" << std::endl;
1164  *out << " </td>" << std::endl;
1165  *out << " <td width=\"32\">" << std::endl;
1166  *out << " <a href=\"/" << urn << "/\">" << std::endl;
1167  *out << " <img" << std::endl;
1168  *out << " align=\"middle\"" << std::endl;
1169  *out << " src=\"/evf/images/idieapp.jpg\"" << std::endl;
1170  *out << " alt=\"main\"" << std::endl;
1171  *out << " width=\"32\"" << std::endl;
1172  *out << " height=\"32\"" << std::endl;
1173  *out << " border=\"\"/>" << std::endl;
1174  *out << " </a>" << std::endl;
1175  *out << " </td>" << std::endl;
1176  *out << "</tr>" << std::endl;
1177  *out << "</table>" << std::endl;
1178  *out << "<hr/>" << std::endl;
1179  *out << "<table><tr><th>Parameter</th><th>Value</th></tr>" << std::endl;
1180  *out << "<tr><td>module legenda messages received</td><td>"
1181  << nModuleLegendaMessageReceived_ << "</td></tr>" << std::endl;
1182  *out << "<tr><td>path legenda messages received</td><td>"
1183  << nPathLegendaMessageReceived_ << "</td></tr>" << std::endl;
1184  *out << "<tr><td>module legenda messages with data</td><td>"
1185  << nModuleLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
1186  *out << "<tr><td>path legenda messages with data</td><td>"
1187  << nPathLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
1188  *out << "<tr><td>dataset legenda messages with data</td><td>"
1189  << nDatasetLegendaMessageWithDataReceived_ << "</td></tr>" << std::endl;
1190  *out << "<tr><td>module histo messages received</td><td>"
1191  << nModuleHistoMessageReceived_<< "</td></tr>" << std::endl;
1192  *out << "<tr><td>path histo messages received</td><td>"
1193  << nPathHistoMessageReceived_<< "</td></tr>" << std::endl;
1194  tm *uptm = localtime(&lastPathLegendaMessageTimeStamp_.tv_sec);
1195  char datestring[256];
1196  strftime(datestring, sizeof(datestring),"%c", uptm);
1197  *out << "<tr><td>time stamp of last path legenda with data</td><td>"
1198  << datestring << "</td></tr>" << std::endl;
1199  uptm = localtime(&lastModuleLegendaMessageTimeStamp_.tv_sec);
1200  strftime(datestring, sizeof(datestring),"%c", uptm);
1201  *out << "<tr><td>time stamp of last module legenda with data</td><td>"
1202  << datestring << "</td></tr>" << std::endl;
1203  *out << "</table></body>" << std::endl;
1204 
1205 }
1206 
1208 {
1209 
1210  //ParameterSetRetriever pr(configString_);
1211  //std::string configuration_ = pr.getAsString();
1212 
1213  std::string configuration_ = configString_;
1214  configuration_.replace(configuration_.find("EMPTYHOST"),9,dqmCollectorHost_.value_);
1215 
1216  //check if port is a number
1217  {
1218  std::string & s = dqmCollectorPort_.value_;
1219  std::string::const_iterator it = s.begin();
1220  while (it != s.end() && std::isdigit(*it)) ++it;
1221  if (it != s.end() || s.empty()) dqmCollectorPort_="0";
1222  }
1223  configuration_.replace(configuration_.find("EMPTYPORT"),9,dqmCollectorPort_.value_);
1224 
1225  PythonProcessDesc ppdesc = PythonProcessDesc(configuration_);
1226  boost::shared_ptr<edm::ProcessDesc> pdesc;
1227  std::vector<std::string> defaultServices = {"InitRootHandlers"};
1228  pdesc = ppdesc.processDesc();
1229  pdesc->addServices(defaultServices);
1230 
1231  if (!pServiceSets_) {
1232  pServiceSets_ = pdesc->getServicesPSets();
1234  }
1235  try {
1237  if(pf != 0) {
1238  pf->makePresence("MessageServicePresence").release();
1239  }
1240  else {
1241  LOG4CPLUS_WARN(getApplicationLogger(),"Unable to create message service presence");
1242  }
1243  }
1244  catch(edm::Exception e) {
1245  LOG4CPLUS_WARN(getApplicationLogger(),e.what());
1246  }
1247 
1248  catch(cms::Exception e) {
1249  LOG4CPLUS_WARN(getApplicationLogger(),e.what());
1250  }
1251 
1252  catch(std::exception e) {
1253  LOG4CPLUS_WARN(getApplicationLogger(),e.what());
1254  }
1255  catch(...) {
1256  LOG4CPLUS_WARN(getApplicationLogger(),"Unknown Exception (Message Presence)");
1257  }
1258 
1259  try {
1261  }
1262  catch (...) {
1263  LOG4CPLUS_WARN(getApplicationLogger(),"Failed creation of service token ");
1264  dqmEnabled_.value_=false;
1265  }
1267 
1268  evtProcessor_ = new edm::EventProcessor(pdesc,
1269  serviceToken_,
1271 
1272  try{
1273  if(edm::Service<DQMStore>().isAvailable())
1275  }
1276  catch(...) {
1277  LOG4CPLUS_WARN(getApplicationLogger(),"exception when trying to get service DQMStore");
1278  dqmEnabled_.value_=false;
1279  }
1280  try{
1281  if(edm::Service<DQMService>().isAvailable())
1283  }
1284  catch(...) {
1285  LOG4CPLUS_WARN(getApplicationLogger(),"exception when trying to get service DQMService");
1286  dqmEnabled_.value_=false;
1287  }
1288  if (!dqmEnabled_.value_) LOG4CPLUS_ERROR(getApplicationLogger(),"Failed to initialize DQMService/DQMStore");
1289 
1290  if (dqmState_!="Removed")
1292 
1293 }
1294 
1296 {
1297  if (!evtProcessor_) return;
1298  dqmStore_->cd();
1299 
1300  meVecRate_.clear();
1301  meVecTime_.clear();
1302  meVecCPU_.clear();
1303  meVecOffenders_.clear();
1304  for (unsigned int i=0;i<epInstances.size();i++) {
1305  currentLs_[i]=0;
1306  }
1307  ilumiprev_ = 0;
1308  savedForLs_=0;
1309  summaryLastLs_ = 0;
1310  pastSavedFiles_.clear();
1311 
1312  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
1313  runId_ = dqmStore_->bookInt("iRun");
1314  runId_->Fill(-1);
1315  lumisecId_ = dqmStore_->bookInt("iLumiSection");
1316  lumisecId_->Fill(-1);
1317  eventId_ = dqmStore_->bookInt("iEvent");
1318  eventId_->Fill(-1);
1319  eventTimeStamp_ = dqmStore_->bookFloat("eventTimeStamp");
1320  runStartTimeStamp_ = dqmStore_->bookFloat("runStartTimeStamp");
1321  initDQMEventInfo();
1322 
1323  for (unsigned int i=0;i<nbSubsClasses;i++) {
1324  std::ostringstream str;
1325  str << nbSubsListInv[i];
1326  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
1327  meVecRate_.push_back(dqmStore_->book1D("EVENT_RATE_"+TString(str.str().c_str()),
1328  "Average event rate for nodes with " + TString(str.str().c_str()) + " EP instances",
1329  4000,1.,4001));
1330  meVecTime_.push_back(dqmStore_->book1D("EVENT_TIME_"+TString(str.str().c_str()),
1331  "Average event processing time for nodes with " + TString(str.str().c_str()) + " EP instances",
1332  4000,1.,4001));
1333  meVecCPU_.push_back(dqmStore_->book1D("UNCORR_CPUUSAGE_"+TString(str.str().c_str())+"_reportSummaryMap",
1334  "Average CPU (%) usage for nodes with " + TString(str.str().c_str()) + " EP instances",
1335  4000,1.,4001));
1336  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Modules/");
1337  meVecOffenders_.push_back(dqmStore_->book2D("MODULE_FRACTION_"+TString(str.str().c_str()),
1338  "Module processing time fraction_"+ TString(str.str().c_str()),
1339  ROLL,1.,1.+ROLL,MODNAMES,0,MODNAMES));
1340  //fill 1 in underrflow bin
1341  meVecOffenders_[i]->Fill(0,1);
1342  occupancyNameMap[i].clear();
1343  }
1344 
1345  //tables
1346  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Tables");
1347  rateSummary_ = dqmStore_->book2D("00_RATE_SUMMARY","Rate Summary (Hz)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
1348  reportPeriodSummary_ = dqmStore_->book2D("00_REPORT_PERIOD_SUMMARY","Average report period (s)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
1349  timingSummary_ = dqmStore_->book2D("01_TIMING_SUMMARY","Event Time Summary (ms)",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
1350  busySummary_ = dqmStore_->book2D("02_BUSY_SUMMARY","Busy fraction ",ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
1351  busySummary2_ = dqmStore_->book2D("03_BUSY_SUMMARY_PROCSTAT","Busy fraction from /proc/stat",ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
1352  busySummaryUncorr1_ = dqmStore_->book2D("04_BUSY_SUMMARY_UNCORR","Busy fraction (uncorrected)",
1353  ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
1354  busySummaryUncorr2_ = dqmStore_->book2D("05_BUSY_SUMMARY_UNCORR_PROCSTAT","Busy fraction from /proc/stat(uncorrected)",
1355  ROLL,0,ROLL,epInstances.size()+2,0,epInstances.size()+2);
1356  fuReportsSummary_ = dqmStore_->book2D("06_EP_REPORTS_SUMMARY","Number of reports received",ROLL,0,ROLL,epInstances.size()+1,0,epInstances.size()+1);
1357 
1358  //everything else goes into layouts folder
1359  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/");
1360  std::ostringstream busySummaryTitle;
1361  busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
1362  lastRunNumberSet_ = runNumber_.value_;
1363  daqBusySummary_ = dqmStore_->book1D("00 reportSummaryMap",busySummaryTitle.str(),4000,1,4001.);
1364  daqBusySummary2_ = dqmStore_->book1D("00 reportSummaryMap_PROCSTAT","DAQ HLT Farm busy (%) from /proc/stat",4000,1,4001.);
1365  daqTotalRateSummary_ = dqmStore_->book1D("00 reportSummaryMap_TOTALRATE","DAQ HLT Farm input rate",4000,1,4001.);
1366 
1367  for (size_t i=1;i<=ROLL;i++) {
1368  std::ostringstream ostr;
1369  ostr << i;
1370  rateSummary_->setBinLabel(i,ostr.str(),1);
1371  reportPeriodSummary_->setBinLabel(i,ostr.str(),1);
1372  timingSummary_->setBinLabel(i,ostr.str(),1);
1373  busySummary_->setBinLabel(i,ostr.str(),1);
1374  busySummary2_->setBinLabel(i,ostr.str(),1);
1375  busySummaryUncorr1_->setBinLabel(i,ostr.str(),1);
1376  busySummaryUncorr2_->setBinLabel(i,ostr.str(),1);
1377  fuReportsSummary_->setBinLabel(i,ostr.str(),1);
1378  }
1379  for (size_t i=1;i<epInstances.size()+1;i++) {
1380  std::ostringstream ostr;
1381  ostr << epInstances[i-1];
1382  rateSummary_->setBinLabel(i,ostr.str(),2);
1383  reportPeriodSummary_->setBinLabel(i,ostr.str(),2);
1384  timingSummary_->setBinLabel(i,ostr.str(),2);
1385  busySummary_->setBinLabel(i,ostr.str(),2);
1386  busySummary2_->setBinLabel(i,ostr.str(),2);
1387  busySummaryUncorr1_->setBinLabel(i,ostr.str(),2);
1388  busySummaryUncorr2_->setBinLabel(i,ostr.str(),2);
1389  fuReportsSummary_->setBinLabel(i,ostr.str(),2);
1390  }
1391  rateSummary_->setBinLabel(epInstances.size()+1,"All",2);
1392  //timingSummary_->setBinLabel(i,"Avg",2);
1393  busySummary_->setBinLabel(epInstances.size()+1,"%Conf",2);
1394  busySummary_->setBinLabel(epInstances.size()+2,"%Max",2);
1395  busySummary2_->setBinLabel(epInstances.size()+1,"%Conf",2);
1396  busySummary2_->setBinLabel(epInstances.size()+2,"%Max",2);
1397  fuReportsSummary_->setBinLabel(epInstances.size()+1,"All",2);
1398 
1399  //wipe out all ls history
1400  for (size_t i=0;i<epInstances.size();i++) {
1401  while (lsHistory[i].size()) {
1402  delete lsHistory[i].front();
1403  lsHistory[i].pop_front();
1404  }
1405  }
1406  while (commonLsHistory.size()) {
1407  delete commonLsHistory.front();
1408  commonLsHistory.pop_front();
1409  }
1410  meInitialized_=true;
1411 
1412 }
1413 
1415  if (!dqmEnabled_.value_ || !evtProcessor_) return;
1416  if (meInitializedStreams_) return;
1417 
1418  //add OUTPUT Stream histograms
1419  endPathRates_.clear();
1420  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Streams/");
1421  for (size_t i=0;i<endPathNames_.size();i++) {
1422  endPathRates_.push_back(dqmStore_->book1D(endPathNames_[i]+"_RATE",endPathNames_[i]+" events/s",4000,1,4001.));
1423  }
1424  meInitializedStreams_=true;
1425 }
1426 
1427 
1429  if (!dqmEnabled_.value_ || !evtProcessor_) return;
1430  if (meInitializedDatasets_) return;
1431 
1432  //add OUTPUT Stream histograms
1433  datasetRates_.clear();
1434  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/Layouts/Datasets/");
1435  for (size_t i=0;i<datasetNames_.size();i++) {
1436  datasetRates_.push_back(dqmStore_->book1D(datasetNames_[i]+"_RATE",datasetNames_[i]+" events/s",4000,1,4001.));
1437  }
1439 }
1440 
1441 
1443 {
1444  if (evtProcessor_) delete evtProcessor_;
1445 }
1446 
1447 void iDie::fillDQMStatHist(unsigned int nbsIdx, unsigned int lsid)
1448 {
1449  if (!evtProcessor_ || lsid==0) return;
1450  unsigned int qsize = lsHistory[nbsIdx].size();
1451  //may be larger size
1452  unsigned int cqsize = lsHistory[nbsIdx].size();
1453 
1454  //update lumis
1455  if (qsize) {
1456  for (int i =(int)qsize-1;i>=0 && i>=(int)qsize-PASTUPDATES;i--) {
1457  unsigned int qpos=(unsigned int) i;
1458  unsigned int forls = lsid - (qsize-1-i);
1459  lsStat * lst = (lsHistory[nbsIdx])[qpos];
1460  unsigned int clsPos = unsigned((int)qpos+ (int)cqsize - (int)qsize);
1461  commonLsStat * clst = commonLsHistory[unsigned((int)qpos+ (int)cqsize - (int)qsize)];
1462 
1463  meVecRate_[nbsIdx]->setBinContent(forls,lst->getRatePerMachine());
1464  meVecRate_[nbsIdx]->setBinError(forls,lst->getRateErrPerMachine());
1465  meVecTime_[nbsIdx]->setBinContent(forls>2? forls:0,lst->getEvtTime()*1000);//msec
1466  meVecTime_[nbsIdx]->setBinError(forls>2? forls:0,lst->getEvtTimeErr()*1000);//msec
1467  meVecCPU_[nbsIdx]->setBinContent(forls,lst->getFracBusy()*100.);
1468  meVecCPU_[nbsIdx]->setBinError(forls,0.);
1469  updateRollingHistos(nbsIdx, forls,lst,clst,i==(int)qsize-1);
1470  //after correcting
1471  commonLsStat * prevclst = clsPos>0 ? commonLsHistory[clsPos-1]:nullptr;
1472  updateStreamHistos(forls,clst,prevclst);
1473  updateDatasetHistos(forls,clst,prevclst);
1474  }
1475  }
1476 }
1477 
1478 void iDie::updateRollingHistos(unsigned int nbsIdx, unsigned int lsid, lsStat * lst, commonLsStat * clst, bool roll) {
1479  unsigned int lsidBin;
1480  if (roll) {
1481  if (lsid>ROLL) {
1482  lsidBin=ROLL;
1483  if (lsid>summaryLastLs_) { //last ls in plots isn't up to date
1484  unsigned int lsdiff = lsid-summaryLastLs_;
1485  for (unsigned int i=1;i<=ROLL;i++) {
1486  if (i<ROLL) {
1487  bool emptyBin=false;
1488  if (i>ROLL-lsdiff) emptyBin=true;
1489  for (unsigned int j=1;j<=epInstances.size()+1;j++) {
1490  rateSummary_->setBinContent(i,j,emptyBin? 0 : rateSummary_->getBinContent(i+lsdiff,j));
1492  timingSummary_->setBinContent(i,j,emptyBin ? 0 : timingSummary_->getBinContent(i+lsdiff,j));
1493  busySummary_->setBinContent(i,j,emptyBin ? 0 : busySummary_->getBinContent(i+lsdiff,j));
1494  busySummary2_->setBinContent(i,j,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,j));
1498  }
1499  busySummary_->setBinContent(i,epInstances.size()+2,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,epInstances.size()+2));
1500  busySummary2_->setBinContent(i,epInstances.size()+2,emptyBin ? 0 : busySummary2_->getBinContent(i+lsdiff,epInstances.size()+2));
1501  }
1502 
1503  std::ostringstream ostr;
1504  ostr << lsid-ROLL+i;
1505  rateSummary_->setBinLabel(i,ostr.str(),1);
1506  reportPeriodSummary_->setBinLabel(i,ostr.str(),1);
1507  timingSummary_->setBinLabel(i,ostr.str(),1);
1508  busySummary_->setBinLabel(i,ostr.str(),1);
1509  busySummary2_->setBinLabel(i,ostr.str(),1);
1510  busySummaryUncorr1_->setBinLabel(i,ostr.str(),1);
1511  busySummaryUncorr2_->setBinLabel(i,ostr.str(),1);
1512  fuReportsSummary_->setBinLabel(i,ostr.str(),1);
1513 
1514  }
1515  summaryLastLs_=lsid;
1516  }
1517  else if (lsid<summaryLastLs_) {
1518  if (summaryLastLs_-lsid>=ROLL) return;//very old
1519  lsidBin=ROLL-(summaryLastLs_-lsid);
1520  }
1521  }
1522  else if (lsid) {lsidBin=lsid;summaryLastLs_=lsid;} else return;
1523  }
1524  else {// previous lumisection updates
1525  unsigned int roll_pos = ROLL-(summaryLastLs_-lsid);
1526  lsidBin=lsid > roll_pos ? roll_pos : lsid;
1527  }
1528 
1529  //how busy is it with current setup
1530  float busyCorr = lst->getFracBusy() * (float)epInstances[nbsIdx]/epMax[nbsIdx];
1531  //max based on how much is configured and max possible
1532  float fracMax = 0.5 + (std::max(epInstances[nbsIdx]-epMax[nbsIdx]/2.,0.)/(epMax[nbsIdx])) *HTscaling[nbsIdx];
1533  if (epInstances[nbsIdx]<epMax[nbsIdx]/2) {
1534  fracMax = epInstances[nbsIdx]/((double)epMax[nbsIdx]);
1535  }
1536 
1537  //corrections for the HT effect
1538  float busyFr=0;
1539  float busyCPUFr=0;
1540  float busyFrTheor=0;
1541  float busyFrCPUTheor=0;
1542 
1543  //microstates based calculation
1544  if (busyCorr>0.5) {//take into account HT scaling for the busy fraction
1545  busyFr=(0.5 + (busyCorr-0.5)*HTscaling[nbsIdx])/fracMax;
1546  busyFrTheor = (0.5+(busyCorr-0.5)*HTscaling[nbsIdx])/ (0.5+0.5*HTscaling[nbsIdx]);
1547  }
1548  else {//below the HT threshold
1549  busyFr=busyCorr / fracMax;
1550  busyFrTheor = busyCorr / (0.5+0.5*HTscaling[nbsIdx]);
1551  }
1552 
1553  //proc/stat based calculation
1554  float busyCorr_CPU = lst->getFracCPUBusy();
1555  if (busyCorr_CPU>0.5) {
1556  busyCPUFr=(0.5 + (busyCorr_CPU-0.5)*HTscaling[nbsIdx])/fracMax;
1557  busyFrCPUTheor = (0.5+(busyCorr_CPU-0.5)*HTscaling[nbsIdx])/ (0.5+0.5*HTscaling[nbsIdx]);
1558  }
1559  else {
1560  busyCPUFr=busyCorr_CPU / fracMax;
1561  busyFrCPUTheor = busyCorr_CPU / (0.5+0.5*HTscaling[nbsIdx]);
1562  }
1563 
1564  //average
1565  clst->setBusyForClass(nbsIdx,lst->getRate(),busyFr,busyFrTheor,busyCPUFr,busyFrCPUTheor,lst->getReports());
1566  float busyAvg = clst->getBusyTotalFrac(false,machineWeightInst);
1567  float busyAvgCPU = clst->getBusyTotalFrac(true,machineWeightInst);
1568 
1569  //rounding
1570  busyFr=fround(busyFr,0.001f);
1571  busyCPUFr=fround(busyCPUFr,0.001f);
1572  busyFrTheor=fround(busyFrTheor,0.001f);
1573  busyFrCPUTheor=fround(busyFrCPUTheor,0.001f);
1574  busyAvg=fround(busyAvg,0.001f);
1575 
1576  //flashlist per-lumi values
1577  if (lsid>2)
1578  while (cpuLoadLastLs_<lsid-2) {
1579  if (cpuLoadLastLs_>=4000-1) break;
1582  cpuLoadTime7_[cpuLoadLastLs_]=meVecTime_[0]->getBinContent(cpuLoadLastLs_+1)*0.001;
1583  cpuLoadTime8_[cpuLoadLastLs_]=meVecTime_[1]->getBinContent(cpuLoadLastLs_+1)*0.001;
1584  cpuLoadTime12_[cpuLoadLastLs_]=meVecTime_[2]->getBinContent(cpuLoadLastLs_+1)*0.001;
1585  cpuLoadTime16_[cpuLoadLastLs_]=meVecTime_[3]->getBinContent(cpuLoadLastLs_+1)*0.001;
1586  cpuLoadTime24_[cpuLoadLastLs_]=meVecTime_[4]->getBinContent(cpuLoadLastLs_+1)*0.001;
1587  cpuLoadTime32_[cpuLoadLastLs_]=meVecTime_[5]->getBinContent(cpuLoadLastLs_+1)*0.001;
1589  cpuLoadRate7_[cpuLoadLastLs_]=meVecRate_[0]->getBinContent(cpuLoadLastLs_+1);
1590  cpuLoadRate8_[cpuLoadLastLs_]=meVecRate_[1]->getBinContent(cpuLoadLastLs_+1);
1595  unsigned int lsidBinForFlash = lsidBin;
1596  if ((lsid-(cpuLoadLastLs_+1)) < lsidBin) lsidBinForFlash-=lsid-(cpuLoadLastLs_+1);
1597  else lsidBinForFlash=1;
1604 
1605  cpuLoadUc7_[cpuLoadLastLs_] = meVecCPU_[0]->getBinContent(cpuLoadLastLs_+1)*0.01;
1606  cpuLoadUc8_[cpuLoadLastLs_] = meVecCPU_[1]->getBinContent(cpuLoadLastLs_+1)*0.01;
1607  cpuLoadUc12_[cpuLoadLastLs_] = meVecCPU_[2]->getBinContent(cpuLoadLastLs_+1)*0.01;
1608  cpuLoadUc16_[cpuLoadLastLs_] = meVecCPU_[3]->getBinContent(cpuLoadLastLs_+1)*0.01;
1609  cpuLoadUc24_[cpuLoadLastLs_] = meVecCPU_[4]->getBinContent(cpuLoadLastLs_+1)*0.01;
1610  cpuLoadUc32_[cpuLoadLastLs_] = meVecCPU_[5]->getBinContent(cpuLoadLastLs_+1)*0.01;
1611 
1612  cpuLoadLastLs_++;
1613  }
1614 
1615  //filling plots
1616  daqBusySummary_->setBinContent(lsid,busyAvg*100.);
1617  daqBusySummary_->setBinError(lsid,0);
1618  daqBusySummary2_->setBinContent(lsid,busyAvgCPU*100.);
1619  daqBusySummary2_->setBinError(lsid,0);
1620 
1623 
1624  //"rolling" histograms
1625  rateSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getRate());
1626  reportPeriodSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getDt());
1627  timingSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getEvtTime()*1000);
1628  fuReportsSummary_->setBinContent(lsidBin,nbsIdx+1,lst->getReports());
1629  busySummary_->setBinContent(lsidBin,nbsIdx+1,fround(busyFr,0.001f));
1630  busySummary2_->setBinContent(lsidBin,nbsIdx+1,fround(busyCPUFr,0.001f));
1631  busySummaryUncorr1_->setBinContent(lsidBin,nbsIdx+1,fround(lst->getFracBusy(),0.001f));
1632  busySummaryUncorr2_->setBinContent(lsidBin,nbsIdx+1,fround(lst->getFracCPUBusy(),0.001f));
1633 
1634  rateSummary_->setBinContent(lsidBin,epInstances.size()+1,clst->getTotalRate());
1635  fuReportsSummary_->setBinContent(lsidBin,epInstances.size()+1,clst->getNReports());
1636 
1637  busySummary_->setBinContent(lsidBin,epInstances.size()+1,fround(busyAvg,0.001f));
1638  busySummary2_->setBinContent(lsidBin,epInstances.size()+1,fround(busyAvgCPU,0.001f));
1639  busySummary_->setBinContent(lsidBin,epInstances.size()+2,fround(clst->getBusyTotalFracTheor(false,machineWeight),0.001f));
1640  busySummary2_->setBinContent(lsidBin,epInstances.size()+2,fround(clst->getBusyTotalFracTheor(true,machineWeight),0.001f));
1641 
1642 }
1643 
1644 void iDie::updateStreamHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
1645 {
1646  if (endPathRates_.size()!=endPathNames_.size()) meInitializedStreams_=false;
1647  initMonitorElementsStreams();//reinitialize (conditionally)
1648  for (size_t i=0;i<endPathRates_.size();i++) {
1649  unsigned int count_current=0;
1650  unsigned int count_last=0;
1651  if (clst->endPathCounts_.size()>i) {
1652  count_current=clst->endPathCounts_[i];
1653  }
1654  endPathRates_[i]->setBinContent(forls,(count_current-count_last)/23.1);//approx ls
1655  }
1656 }
1657 
1658 
1659 void iDie::updateDatasetHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
1660 {
1661  if (datasetRates_.size()!=datasetNames_.size()) meInitializedDatasets_=false;
1662  initMonitorElementsDatasets();//reinitialize (conditionally)
1663  for (size_t i=0;i<datasetRates_.size();i++) {
1664  unsigned int count_current=0;
1665  unsigned int count_last=0;
1666  if (clst->datasetCounts_.size()>i) {
1667  count_current=clst->datasetCounts_[i];
1668  }
1669  datasetRates_[i]->setBinContent(forls,(count_current-count_last)/23.1);//approx ls
1670  }
1671 }
1672 
1673 
1674 void iDie::fillDQMModFractionHist(unsigned int nbsIdx, unsigned int lsid, unsigned int nonIdle, std::vector<std::pair<unsigned int,unsigned int>> offenders)
1675 {
1676  if (!evtProcessor_) return;
1677  MonitorElement * me = meVecOffenders_[nbsIdx];
1678  //shift bin names by 1
1679  unsigned int xBinToFill=lsid;
1680  if (lsid>ROLL) {
1681  for (unsigned int i=1;i<=ROLL;i++) {
1682  for (unsigned int j=1;j<=MODNAMES;j++) {
1683  if (i<ROLL)
1684  me->setBinContent(i,j,me->getBinContent(i+1,j));
1685  else
1686  me->setBinContent(i,j,0);
1687  }
1688  std::ostringstream ostr;
1689  ostr << lsid-ROLL+i;
1690  me->setBinLabel(i,ostr.str(),1);
1691  }
1692  std::ostringstream ostr;
1693  ostr << lsid;
1694  xBinToFill=ROLL;
1695  }
1696  float nonIdleInv=0.;
1697  if (nonIdle>0)nonIdleInv=1./(double)nonIdle;
1698  //1st pass (there are free bins left)
1699  for (unsigned int i=0;i<offenders.size();i++) {
1700  unsigned int x=offenders[i].first;
1701  float percentageUsed=offenders[i].second*nonIdleInv;
1702  if (percentageUsed>0.02) {//2% threshold
1703  if (occupancyNameMap[nbsIdx].count(x)==0) {//new element
1704  unsigned int y=occupancyNameMap[nbsIdx].size();
1705  if (y<MODNAMES) {
1706  (occupancyNameMap[nbsIdx])[x]=y;
1707  me->setBinContent(xBinToFill,y+1,fround(percentageUsed,0.001f));
1708  me->setBinLabel(y+1,mapmod_[x],2);
1709  }
1710  else break;
1711  }
1712  }
1713  }
1714  //2nd pass (beyond available bins)
1715  for (unsigned int i=0;i<offenders.size();i++) {
1716  unsigned int x=offenders[i].first;
1717  float percentageUsed=offenders[i].second*nonIdleInv;
1718  if (percentageUsed>0.02) {//2% threshold
1719  if (occupancyNameMap[nbsIdx].count(x)==0) {
1720  unsigned int y=occupancyNameMap[nbsIdx].size();
1721  if (y>=MODNAMES && xBinToFill>1) {
1722  //filled up, replace another one
1723  float minbinval=1.;
1724  unsigned int toReplace=0;
1725  for (size_t j=1;j<=MODNAMES;j++) {
1726  //decide based on the smallest value
1727  float bin=me->getBinContent(xBinToFill,j);
1728  if (bin<minbinval) {toReplace=j;minbinval=bin;}
1729  }
1730  if (percentageUsed>minbinval && toReplace) {
1731  int key=-1;
1732  for (auto it = occupancyNameMap[nbsIdx].begin(); it != occupancyNameMap[nbsIdx].end(); ++it) {
1733  if (it->second == toReplace-1) {
1734  key = it->first;
1735  break;
1736  }
1737  }
1738  if (key>-1) {
1739  //erase old
1740  occupancyNameMap[nbsIdx].erase(key);
1741  //add new
1742  (occupancyNameMap[nbsIdx])[x]=toReplace-1;
1743  //fill histogram
1744  me->setBinContent(xBinToFill,toReplace,fround(percentageUsed,0.001f));
1745  me->setBinLabel(toReplace,mapmod_[x],2);
1746  //reset fields for previous lumis
1747  unsigned qsize = lsHistory[nbsIdx].size();
1748  for (size_t k=1;k<xBinToFill;k++) {
1749  if (xBinToFill-k+1<qsize) {
1750  float fr = (lsHistory[nbsIdx])[qsize-xBinToFill+k-1]->getOffenderFracAt(x);
1751  if (fr>0.02) me->setBinContent(k,toReplace,fround(fr,0.001f));
1752  }
1753  else
1754  me->setBinContent(k,toReplace,0);
1755  }
1756  }
1757  }
1758  }
1759  }
1760  else {
1761  unsigned int y=(occupancyNameMap[nbsIdx])[x];
1762  me->setBinContent(xBinToFill,y+1,fround(percentageUsed,0.001f));
1763  }
1764  }
1765  }
1766 }
1767 
1769  if (dqmEnabled_.value_)
1771 }
1772 
1773 void iDie::timeExpired(toolbox::task::TimerEvent& e)
1774 {
1775  //bool pushUpdate=false;
1776  if (debugMode_.value_)
1777  std::cout << "debug - runNumber:" << runNumber_ << " run active:" << runActive_ << std::endl;
1778  if (!runActive_) return;
1779  if (!runNumber_) return;
1780  try
1781  {
1782 
1783  if (debugMode_.value_) std::cout << " checking per-lumi flashlist" << std::endl;
1784 
1787  {
1788  unsigned int toSend = cpuLoadLastLs_;
1789  if (toSend) {
1790  toSend--;
1791  cpuInfoSpace_->lock();
1794  flashLoadLs_=toSend+1;
1795  flashLoad_=cpuLoad_[toSend];
1796  flashLoadPS_=cpuLoadPS_[toSend];
1803  flashLoadRate_=cpuLoadRate_[toSend];
1804 
1811 
1812  flashLoadUc7_=cpuLoadUc7_[toSend];
1813  flashLoadUc8_=cpuLoadUc8_[toSend];
1814  flashLoadUc12_=cpuLoadUc12_[toSend];
1815  flashLoadUc16_=cpuLoadUc16_[toSend];
1816  flashLoadUc24_=cpuLoadUc24_[toSend];
1817  flashLoadUc32_=cpuLoadUc32_[toSend];
1818 
1819  flashReports7_ = cpuLoadReports7_[toSend];
1820  flashReports8_ = cpuLoadReports8_[toSend];
1821  flashReports12_ = cpuLoadReports12_[toSend];
1822  flashReports16_ = cpuLoadReports16_[toSend];
1823  flashReports24_ = cpuLoadReports24_[toSend];
1824  flashReports32_ = cpuLoadReports32_[toSend];
1825 
1826  cpuLoadSentLs_++;
1827  cpuInfoSpace_->unlock();
1829 
1830  if (debugMode_.value_)
1831  std::cout << "debug - updated lumi flashlist with values "
1832  << flashLoadLs_ << " " << flashLoad_ << " " << flashLoadPS_
1833  << " t:" << flashLoadTime7_ << " " << flashLoadTime8_ << " " << flashLoadTime12_ << " "
1834  << flashLoadTime16_ << " " << flashLoadTime24_ << flashLoadTime32_ << " r:" << flashLoadRate_ << std::endl;
1835 
1836  cpuInfoSpace_->fireItemGroupChanged(monNames_, this);
1837 
1838  }
1839  }
1840  }
1841  }
1842  catch (xdata::exception::Exception& xe)
1843  {
1844  LOG4CPLUS_WARN(getApplicationLogger(), xe.what() );
1845  }
1846  catch (std::exception& se)
1847  {
1848  std::string msg = "Caught standard exception while trying to collect: ";
1849  msg += se.what();
1850  LOG4CPLUS_WARN(getApplicationLogger(), msg );
1851  }
1852  catch (...)
1853  {
1854  std::string msg = "Caught unknown exception while trying to collect";
1855  LOG4CPLUS_WARN(getApplicationLogger(), msg );
1856  }
1857 }
1858 
1859 void iDie::perLumiFileSaver(unsigned int lsid)
1860 {
1861 
1862  //make sure that run number is updated before saving
1864  if (meInitialized_) {
1865  std::ostringstream busySummaryTitle;
1866  busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
1867  daqBusySummary_->setTitle(busySummaryTitle.str());
1868  lastRunNumberSet_ = runNumber_.value_;
1869  }
1870  }
1871 
1872  if (dqmSaveDir_.value_=="") return;
1873  //try to create directory if not there
1874 
1875  if (savedForLs_==0)
1876  {
1877  struct stat st;
1878  if (stat((dqmSaveDir_.value_+"/output").c_str(),&st) != 0) {
1879  if (mkdir((dqmSaveDir_.value_+"/output").c_str(), 0777) != 0) {
1880  LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not find nor create DQM \"output\" directory. DQM archiving -> Off.");
1881  dqmSaveDir_.value_="";//reset parameter
1882  return;
1883  }
1884  }
1885  if (stat((dqmSaveDir_.value_+"/done").c_str(),&st) != 0) {
1886  if (mkdir((dqmSaveDir_.value_+"/done").c_str(), 0777) != 0) {
1887  LOG4CPLUS_WARN(getApplicationLogger(),"iDie could not find nor create DQM \"done\" directory. DQM archiving might fail.");
1888  }
1889  }
1890  //static filename part
1891  char version[8];
1892  sprintf(version, "_V%04d_", int(1));
1893  version[7]='\0';
1894  std::string sDir = dqmSaveDir_.value_;
1895  if (sDir[sDir.size()-1]!='/') sDir+="/";
1896  sDir+="output/";
1897  fileBaseName_ = sDir + "DQM" + version;
1898 
1899  //checking if directory is there
1900  if ( access( sDir.c_str(), 0 ) == 0 )
1901  {
1902  struct stat status;
1903  stat( sDir.c_str(), &status );
1904 
1905  if ( status.st_mode & S_IFDIR ) writeDirectoryPresent_=true;
1906  else writeDirectoryPresent_=false;
1907  }
1908  }
1909 
1910  if (lsid > 0 && (lsid%saveLsInterval_.value_)==0 && lsid>savedForLs_ && writeDirectoryPresent_)
1911  {
1912  savedForLs_=lsid;
1913  char suffix[64];
1914  char rewrite[128];
1915  sprintf(suffix, "_R%09d_L%06d", runNumber_.value_, lsid);
1916  sprintf(rewrite, "\\1Run %d/\\2/By Lumi Section %d-%d", runNumber_.value_, ilumiprev_, lsid);
1917 
1918  std::vector<std::string> systems = {topLevelFolder_.value_};
1919 
1920  for (size_t i = 0, e = systems.size(); i != e; ++i) {
1921  std::string filename = fileBaseName_ + systems[i] + suffix + ".root";
1922  try {
1923  dqmStore_->save(filename, systems[i] , "^(Reference/)?([^/]+)",
1925  pastSavedFiles_.push_back(filename);
1926  if (dqmFilesWritable_.value_)
1927  chmod(filename.c_str(),0777);//allow deletion by dqm script
1928  //if (pastSavedFiles_.size() > 500)
1929  //{
1930  //remove(pastSavedFiles_.front().c_str());
1931  //pastSavedFiles_.pop_front();
1932  //}
1933  }
1934  catch (...) {
1935  LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not create root file " << filename);
1936  }
1937  }
1938 
1939  ilumiprev_ = lsid;
1940 
1941  //cd() to micro report root file
1942  if (f_)
1943  f_->cd();
1944  }
1945 }
1946 
1947 
1948 
1950 {
1951 
1952  //make sure that run number is updated before saving
1954  if (meInitialized_) {
1955  std::ostringstream busySummaryTitle;
1956  busySummaryTitle << "DAQ HLT Farm busy (%) for run "<< runNumber_.value_;
1957  daqBusySummary_->setTitle(busySummaryTitle.str());
1958  lastRunNumberSet_ = runNumber_.value_;
1959  }
1960  }
1961 
1962  if (dqmSaveDir_.value_=="") return;
1963 
1964  //save interval (+9 every minutes after initial)
1965  std::vector<unsigned int> minutes = {4,8,12,20};
1966 
1967  //directory should already be there
1968  //first invocation - just record time
1969  if (!reportingStart_) {
1970  reportingStart_ = new timeval;
1971  gettimeofday(reportingStart_,0);
1973  return;
1974  }
1975  timeval new_ts;
1976  gettimeofday(&new_ts,0);
1977 
1978  unsigned int dT = (new_ts.tv_sec - reportingStart_->tv_sec) / 60;
1979 
1980  unsigned int willSaveForTime = 0;
1981 
1982  for (size_t i=0;i<minutes.size();i++) {
1983  if (dT>=minutes[i]) {
1984  if (lastSavedForTime_ < minutes[i]) {
1985  willSaveForTime=dT;
1986  lastSavedForTime_=dT;
1987  break;
1988  }
1989  }
1990  }
1991 
1992  //in periodic part
1993  unsigned int lastMinutesTime = minutes[minutes.size()-1];
1994  if (!willSaveForTime && dT>lastMinutesTime)
1995  {
1996  if (lastSavedForTime_<lastMinutesTime || (dT-lastMinutesTime)/9 > (lastSavedForTime_-lastMinutesTime)/9) {
1997  willSaveForTime=dT;
1998  lastSavedForTime_=dT;
1999  }
2000  }
2001  if (willSaveForTime && writeDirectoryPresent_)
2002  {
2003  char suffix[64];
2004  char rewrite[128];
2005  //sprintf(suffix, "_R%09d_T%08d", runNumber_.value_, willSaveForTime);
2006  sprintf(suffix, "_R%09d", runNumber_.value_);
2007  sprintf(rewrite, "\\1Run %d/\\2/Run summary", runNumber_.value_);
2008 
2009  std::vector<std::string> systems = {topLevelFolder_.value_};
2010 
2011  for (size_t i = 0, e = systems.size(); i != e; ++i) {
2012  std::string filename = fileBaseName_ + systems[i] + suffix + ".root";
2013  try {
2014  dqmStore_->save(filename, systems[i] , "^(Reference/)?([^/]+)",
2016  if (dqmFilesWritable_.value_)
2017  chmod(filename.c_str(),0777);//allow deletion by dqm script
2018  }
2019  catch (...) {
2020  LOG4CPLUS_ERROR(getApplicationLogger(),"iDie could not create root file " << filename);
2021  }
2022  }
2023 
2024  //cd() to micro report root file
2025  if (f_)
2026  f_->cd();
2027  }
2028 }
2029 
2030 
2032 {
2033  struct timeval now;
2034  gettimeofday(&now, 0);
2035  double time_now = now.tv_sec + 1e-6*now.tv_usec;
2036 
2037  dqmStore_->setCurrentFolder(topLevelFolder_.value_ + "/EventInfo/");
2038  runId_ = dqmStore_->bookInt("iRun");
2039  runId_->Fill(-1);
2040  lumisecId_ = dqmStore_->bookInt("iLumiSection");
2041  lumisecId_->Fill(-1);
2042  eventId_ = dqmStore_->bookInt("iEvent");
2043  eventId_->Fill(-1);
2044  eventTimeStamp_ = dqmStore_->bookFloat("eventTimeStamp");
2045 
2046  runStartTimeStamp_ = dqmStore_->bookFloat("runStartTimeStamp");
2047 
2048  processTimeStampMe_ = dqmStore_->bookFloat("processTimeStamp");
2049  processTimeStampMe_->Fill(time_now);
2050  processLatencyMe_ = dqmStore_->bookFloat("processLatency");
2051  processLatencyMe_->Fill(-1);
2052  processEventsMe_ = dqmStore_->bookInt("processedEvents");
2053  processEventsMe_->Fill(0);
2054  processEventRateMe_ = dqmStore_->bookFloat("processEventRate");
2055  processEventRateMe_->Fill(-1);
2056  nUpdatesMe_= dqmStore_->bookInt("processUpdates");
2057  nUpdatesMe_->Fill(-1);
2058  processIdMe_= dqmStore_->bookInt("processID");
2059  processIdMe_->Fill(getpid());
2060  processStartTimeStampMe_ = dqmStore_->bookFloat("processStartTimeStamp");
2061  processStartTimeStampMe_->Fill(time_now);
2062  hostNameMe_= dqmStore_->bookString("hostName","cmsidie");
2063  processNameMe_= dqmStore_->bookString("processName","iDie");
2064  workingDirMe_= dqmStore_->bookString("workingDir","/tmp");
2066 }
2067 
2069 {
2070  struct timeval now;
2071  gettimeofday(&now, 0);
2072  double time_now = now.tv_sec + 1e-6*now.tv_usec;
2073  runTS_ = time_now;
2074 }
2075 
2077 // xdaq instantiator implementation macro
2079 
2080 XDAQ_INSTANTIATOR_IMPL(iDie)
xdata::Boolean debugMode_
Definition: iDie.h:657
unsigned int cpuLoadReports12_[4000]
Definition: iDie.h:246
static const char runNumber_[]
virtual char const * what() const
Definition: Exception.cc:141
std::string dqmState_
Definition: iDie.h:198
xdata::UnsignedInteger32 flashReports16_
Definition: iDie.h:280
dbl * delta
Definition: mlp_gen.cc:36
float getRate()
Definition: iDie.h:547
std::vector< std::pair< unsigned int, unsigned int > > getOffendersVector()
Definition: iDie.h:605
MonitorElement * daqTotalRateSummary_
Definition: iDie.h:676
unsigned int cpuLoadReports16_[4000]
Definition: iDie.h:247
void updateDatasetHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
Definition: iDie.cc:1659
int i
Definition: DBlmapReader.cc:9
float cpuLoadUc24_[4000]
Definition: iDie.h:241
timeval runStartDetectedTimeStamp_
Definition: iDie.h:338
std::atomic< unsigned int > cpuLoadSentLs_
Definition: iDie.h:216
TFile * f_
Definition: iDie.h:320
xdata::UnsignedInteger32 runNumber_
Definition: iDie.h:205
xdata::Boolean dqmEnabled_
Definition: iDie.h:656
MonitorElement * busySummary2_
Definition: iDie.h:670
int * datap_
Definition: iDie.h:327
timeval lastModuleLegendaMessageTimeStamp_
Definition: iDie.h:339
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hostNameMe_
Definition: iDie.h:298
void setRunStartTimeStamp()
Definition: iDie.cc:2068
unsigned int summaryLastLs_
Definition: iDie.h:678
#define Input(cl)
Definition: vmac.h:189
std::vector< float > machineWeightInst
Definition: iDie.h:352
float latencyTS_
Definition: iDie.h:304
xdata::Float flashLoadPS_
Definition: iDie.h:252
xdata::UnsignedInteger32 instance_
Definition: iDie.h:202
void parseDatasetLegenda(std::string)
Definition: iDie.cc:999
std::deque< commonLsStat * > commonLsHistory
Definition: iDie.h:681
unsigned int cpuLoadReports7_[4000]
Definition: iDie.h:244
float cpuLoadTime24_[4000]
Definition: iDie.h:225
unsigned int nbSubsClasses
Definition: iDie.h:661
int nModuleLegendaMessageWithDataReceived_
Definition: iDie.h:334
iDie(xdaq::ApplicationStub *s)
Definition: iDie.cc:56
void setBusyForClass(unsigned int classIdx, float rate, float busy, float busyTheor, float busyCPU, float busyCPUTheor, unsigned int nMachineReports)
Definition: iDie.h:381
int nPathHistoMessageReceived_
Definition: iDie.h:337
MonitorElement * busySummaryUncorr2_
Definition: iDie.h:672
xdata::UnsignedInteger32 flashLoadLs_
Definition: iDie.h:214
float cpuLoadRate16_[4000]
Definition: iDie.h:233
float cpuLoadPS_[4000]
Definition: iDie.h:219
static PluginManager & configure(const Config &)
MonitorElement * processStartTimeStampMe_
Definition: iDie.h:297
xdata::UnsignedInteger32 flashReports32_
Definition: iDie.h:282
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
float cpuLoadUc32_[4000]
Definition: iDie.h:242
MonitorElement * daqBusySummary_
Definition: iDie.h:674
void updateRollingHistos(unsigned int nbsIdx, unsigned int lsid, lsStat *lst, commonLsStat *clst, bool roll)
Definition: iDie.cc:1478
float getDt()
Definition: iDie.h:600
int ii(size_t ind)
Definition: iDie.h:158
xdata::Float flashLoadTime7_
Definition: iDie.h:254
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
unsigned int dsMismatch
Definition: iDie.h:705
void parsePathLegenda(std::string)
Definition: iDie.cc:960
int etimesRun[evf::max_endpaths]
Definition: iDie.h:81
unsigned int nstates_
Definition: iDie.h:311
MonitorElement * workingDirMe_
Definition: iDie.h:300
MonitorElement * daqBusySummary2_
Definition: iDie.h:675
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
float cpuLoadRate8_[4000]
Definition: iDie.h:231
#define nullptr
boost::tokenizer< boost::char_separator< char > > tokenizer
xdata::UnsignedInteger32 flashReports24_
Definition: iDie.h:281
xdata::UnsignedInteger32 saveLsInterval_
Definition: iDie.h:692
std::vector< std::map< unsigned int, unsigned int > > occupancyNameMap
Definition: iDie.h:679
void initDQMEventInfo()
Definition: iDie.cc:2031
int ptimesFailed[evf::max_paths]
Definition: iDie.h:79
xdata::String dqmCollectorPort_
Definition: iDie.h:307
xdata::Float flashLoadRate12_
Definition: iDie.h:265
timeval * reportingStart_
Definition: iDie.h:702
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
TBranch * b4_
Definition: iDie.h:326
void initMonitorElementsStreams()
Definition: iDie.cc:1414
PathSummaryStatic trigPathSummaries[max_paths]
int ptimesPassedPs[evf::max_paths]
Definition: iDie.h:76
void postEntryiChoke(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:699
void perLumiFileSaver(unsigned int lsid)
Definition: iDie.cc:1859
int nModuleHistoMessageReceived_
Definition: iDie.h:336
float cpuLoadUc16_[4000]
Definition: iDie.h:240
int nDatasetLegendaMessageReceived_
Definition: iDie.h:342
edm::EventProcessor * evtProcessor_
Definition: iDie.h:649
int etimesFailed[evf::max_endpaths]
Definition: iDie.h:85
void addToReport(TriggerReportStatic *trs, TriggerReportStatic *trp, unsigned int lumisection)
xdata::Float flashLoadUc32_
Definition: iDie.h:275
std::vector< MonitorElement * > meVecTime_
Definition: iDie.h:663
void iChoke(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:573
int lst[30]
void fillDQMStatHist(unsigned int nbsIdx, unsigned int lsid)
Definition: iDie.cc:1447
MonitorElement * lumisecId_
Definition: iDie.h:286
std::vector< unsigned int > currentLs_
Definition: iDie.h:690
std::vector< MonitorElement * > endPathRates_
Definition: iDie.h:685
std::pair< unsigned int, unsigned int > * getModuleSamplingPtr()
Definition: iDie.h:499
float cpuLoad_[4000]
Definition: iDie.h:218
void parseModuleLegenda(std::string)
Definition: iDie.cc:808
int ptimesExcept[evf::max_paths]
Definition: iDie.h:80
xdata::Float flashLoadUc12_
Definition: iDie.h:272
float cpuLoadUc7_[4000]
Definition: iDie.h:237
void sleep(Duration_t)
Definition: Utils.h:163
unsigned int savedForLs_
Definition: iDie.h:698
MonitorElement * eventId_
Definition: iDie.h:287
std::vector< MonitorElement * > meVecRate_
Definition: iDie.h:662
tuple node
Definition: Node.py:50
std::string fileBaseName_
Definition: iDie.h:699
unsigned int getReports()
Definition: iDie.h:596
float getBusyTotalFrac(bool procstat, std::vector< float > &machineWeightInst)
Definition: iDie.h:396
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
void perTimeFileSaver()
Definition: iDie.cc:1949
void updater(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:460
SaveReferenceTag
Definition: DQMStore.h:70
unsigned int getNSampledNonIdle()
Definition: iDie.h:581
void Fill(long long x)
float getTotalRate()
Definition: iDie.h:390
float cpuLoadTime12_[4000]
Definition: iDie.h:223
void update(unsigned int nSampledNonIdle, unsigned int nSampledIdle, unsigned int nProc, unsigned int ncpubusy, unsigned int deltaTms)
Definition: iDie.h:484
void deleteFramework()
Definition: iDie.cc:1442
TBranch * b2_
Definition: iDie.h:324
xdata::String class_
Definition: iDie.h:201
bool meInitializedStreams_
Definition: iDie.h:651
std::vector< unsigned int > datasetCounts_
Definition: iDie.h:368
unsigned int cpuLoadReports8_[4000]
Definition: iDie.h:245
bool runActive_
Definition: iDie.h:207
std::vector< int > cpuentries_
Definition: iDie.h:312
std::vector< unsigned int > epMax
Definition: iDie.h:348
TTree * t_
Definition: iDie.h:321
void fillDQMModFractionHist(unsigned int nbsIdx, unsigned int lsid, unsigned int nonIdle, std::vector< std::pair< unsigned int, unsigned int >> offenders)
Definition: iDie.cc:1674
MonitorElement * cmsswVerMe_
Definition: iDie.h:301
float runTS_
Definition: iDie.h:303
unsigned int lastSavedForTime_
Definition: iDie.h:703
std::vector< int > trpentries_
Definition: iDie.h:317
bool meInitialized_
Definition: iDie.h:650
int nModuleLegendaMessageReceived_
Definition: iDie.h:332
PluginManager::Config config()
Definition: standard.cc:22
float fround(float val, float mod)
Definition: iDie.h:719
std::vector< TriggerReportStatic > trp_
Definition: iDie.h:316
void spotlight(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:1120
std::vector< std::vector< int > > cpustat_
Definition: iDie.h:313
xdata::Float flashLoadTime32_
Definition: iDie.h:259
float cpuLoadUc8_[4000]
Definition: iDie.h:238
float cpuLoadUc12_[4000]
Definition: iDie.h:239
xdata::Float flashLoadRate32_
Definition: iDie.h:268
const T & max(const T &a, const T &b)
xdata::Float flashLoadUc8_
Definition: iDie.h:271
unsigned int totalCores_
Definition: iDie.h:310
float cpuLoadTime7_[4000]
Definition: iDie.h:221
MonitorElement * processLatencyMe_
Definition: iDie.h:292
MonitorElement * processNameMe_
Definition: iDie.h:299
void initFramework()
Definition: iDie.cc:1207
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:683
xdata::Float flashLoadUc24_
Definition: iDie.h:274
DatasetSummaryStatic datasetSummaries[max_datasets]
xdata::UnsignedInteger32 flashReports12_
Definition: iDie.h:279
void updateStreamHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
Definition: iDie.cc:1644
void reset(TriggerReportStatic *)
xdata::Float flashLoadTime24_
Definition: iDie.h:258
int etimesPassedL1[evf::max_endpaths]
Definition: iDie.h:83
int j
Definition: DBlmapReader.cc:9
internal::rate r_
Definition: iDie.h:329
xdata::UnsignedInteger32 flashReports8_
Definition: iDie.h:278
MonitorElement * processIdMe_
Definition: iDie.h:296
double f[11][100]
xoap::MessageReference fsmCallback(xoap::MessageReference msg)
Definition: iDie.cc:316
PathSummaryStatic endPathSummaries[max_endpaths]
int etimesPassed[evf::max_endpaths]
Definition: iDie.h:84
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
TBranch * b3_
Definition: iDie.h:325
unsigned int cpuLoadReports32_[4000]
Definition: iDie.h:249
MonitorElement * eventTimeStamp_
Definition: iDie.h:288
std::atomic< unsigned int > cpuLoadLastLs_
Definition: iDie.h:215
DQMStore * dqmStore_
Definition: iDie.h:654
static ServiceToken createSet(std::vector< ParameterSet > &)
void actionPerformed(xdata::Event &e)
Definition: iDie.cc:291
#define ROLL
Definition: iDie.cc:48
Definition: iDie.h:93
void flushStandalone()
Definition: DQMService.cc:106
MonitorElement * timingSummary_
Definition: iDie.h:668
xdata::Float flashLoadUc7_
Definition: iDie.h:270
void detailsTable(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:474
std::vector< MonitorElement * > meVecCPU_
Definition: iDie.h:664
void timeExpired(toolbox::task::TimerEvent &e)
Definition: iDie.cc:1773
void postEntry(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:587
bool writeDirectoryPresent_
Definition: iDie.h:700
unsigned int getNReports()
Definition: iDie.h:426
float cpuLoadRate32_[4000]
Definition: iDie.h:235
xdata::Float flashLoadRate16_
Definition: iDie.h:266
#define PASTUPDATES
Definition: iDie.cc:49
int etimesExcept[evf::max_endpaths]
Definition: iDie.h:86
xdata::Float flashLoadTime16_
Definition: iDie.h:257
MonitorElement * rateSummary_
Definition: iDie.h:666
MonitorElement * busySummary_
Definition: iDie.h:669
int k[5][pyjets_maxn]
float cpuLoadRate12_[4000]
Definition: iDie.h:232
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
tuple out
Definition: dbtoconf.py:99
void doFlush()
Definition: iDie.cc:1768
void parsePathHisto(const unsigned char *, unsigned int)
Definition: iDie.cc:1018
MonitorElement * busySummaryUncorr1_
Definition: iDie.h:671
std::string getReleaseVersion()
static PresenceFactory * get()
int ptimesPassedL1[evf::max_paths]
Definition: iDie.h:77
string host
Definition: query.py:114
std::vector< std::string > datasetNames_
Definition: iDie.h:355
void dumpTable(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:494
fmap fus_
Definition: iDie.h:308
void initMonitorElements()
Definition: iDie.cc:1295
timeval lastPathLegendaMessageTimeStamp_
Definition: iDie.h:340
int nDatasetLegendaMessageWithDataReceived_
Definition: iDie.h:343
xdata::InfoSpace * cpuInfoSpace_
Definition: iDie.h:213
std::vector< float > HTscaling
Definition: iDie.h:349
std::vector< float > machineWeight
Definition: iDie.h:351
std::vector< unsigned int > epInstances
Definition: iDie.h:347
std::map< int, unsigned int > nbSubsListInv
Definition: iDie.h:660
float cpuLoadRate_[4000]
Definition: iDie.h:228
xdata::String dqmCollectorHost_
Definition: iDie.h:306
unsigned int ccount
Definition: iDie.h:64
std::vector< MonitorElement * > datasetRates_
Definition: iDie.h:688
void defaultWeb(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:416
boost::shared_ptr< edm::ProcessDesc > processDesc()
std::auto_ptr< Presence > makePresence(std::string const &presence_type) const
void iChokeMiniInterface(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:517
unsigned int last_ls_
Definition: iDie.h:315
part
Definition: HCALResponse.h:21
xdata::UnsignedInteger32 flashReports7_
Definition: iDie.h:277
std::vector< std::string > mappath_
Definition: iDie.h:318
MonitorElement * processTimeStampMe_
Definition: iDie.h:291
float getFracCPUBusy()
Definition: iDie.h:591
std::vector< std::string > endPathNames_
Definition: iDie.h:354
DQMService * dqmService_
Definition: iDie.h:653
xdata::Float flashLoadTime8_
Definition: iDie.h:255
void initMonitorElementsDatasets()
Definition: iDie.cc:1428
int nPathLegendaMessageWithDataReceived_
Definition: iDie.h:335
float cpuLoadRate24_[4000]
Definition: iDie.h:234
TBranch * b1_
Definition: iDie.h:323
char state
Definition: procUtils.cc:75
MonitorElement * reportPeriodSummary_
Definition: iDie.h:667
xdata::Float flashLoadRate_
Definition: iDie.h:261
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
MonitorElement * nUpdatesMe_
Definition: iDie.h:295
xdata::String dqmSaveDir_
Definition: iDie.h:695
double getBinContent(int binx) const
get content of bin (1-D)
boost::shared_ptr< std::vector< edm::ParameterSet > > pServiceSets_
Definition: iDie.h:647
xdata::String hostname_
Definition: iDie.h:203
#define begin
Definition: vmac.h:31
float cpuLoadTime32_[4000]
Definition: iDie.h:226
int nPathLegendaMessageReceived_
Definition: iDie.h:333
list key
Definition: combine.py:13
edm::ServiceToken serviceToken_
Definition: iDie.h:648
void parseModuleHisto(const char *, unsigned int)
Definition: iDie.cc:829
#define Output(cl)
Definition: vmac.h:193
std::vector< MonitorElement * > meVecOffenders_
Definition: iDie.h:665
float cpuLoadTime16_[4000]
Definition: iDie.h:224
MonitorElement * processEventsMe_
Definition: iDie.h:293
TriggerReportStatic * trppriv_
Definition: iDie.h:328
tuple filename
Definition: lut2db_cfg.py:20
void reset()
Definition: iDie.cc:778
void summaryTable(xgi::Input *in, xgi::Output *out)
Definition: iDie.cc:466
virtual ~iDie()
Definition: iDie.cc:286
xdata::String topLevelFolder_
Definition: iDie.h:697
unsigned int ilumiprev_
Definition: iDie.h:693
MonitorElement * fuReportsSummary_
Definition: iDie.h:673
xdata::Float flashLoadRate24_
Definition: iDie.h:267
static const int STATUS_OK
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
fmap::iterator ifmap
Definition: iDie.h:91
timeval lastDatasetLegendaMessageTimeStamp_
Definition: iDie.h:344
MonitorElement * processEventRateMe_
Definition: iDie.h:294
tuple cout
Definition: gather_cfg.py:121
xdata::Float flashLoadRate7_
Definition: iDie.h:263
float getFracBusy()
Definition: iDie.h:586
#define MODNAMES
Definition: iDie.h:55
xdata::Float flashLoadUc16_
Definition: iDie.h:273
float cpuLoadRate7_[4000]
Definition: iDie.h:230
unsigned int ls_
Definition: iDie.h:360
edm::EventSummary eventSummary
xdata::Float flashLoad_
Definition: iDie.h:251
std::deque< lsStat * > * lsHistory
Definition: iDie.h:682
bool meInitializedDatasets_
Definition: iDie.h:652
tuple status
Definition: ntuplemaker.py:245
MonitorElement * runStartTimeStamp_
Definition: iDie.h:289
x
Definition: VDTMath.h:216
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
TBranch * b_
Definition: iDie.h:322
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
xdata::Float flashLoadTime12_
Definition: iDie.h:256
xdata::Float flashLoadRate8_
Definition: iDie.h:264
unsigned int lastRunNumberSet_
Definition: iDie.h:206
xdata::Boolean dqmFilesWritable_
Definition: iDie.h:696
void reset(double vett[256])
Definition: TPedValues.cc:11
std::map< unsigned int, int > nbSubsList
Definition: iDie.h:659
int ptimesPassed[evf::max_paths]
Definition: iDie.h:78
float cpuLoadTime8_[4000]
Definition: iDie.h:222
tuple size
Write out results.
std::string configString_
Definition: iDie.h:655
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::list< std::string > pastSavedFiles_
Definition: iDie.h:694
int ptimesRun[evf::max_paths]
Definition: iDie.h:75
xdata::String url_
Definition: iDie.h:200
float getEvtTime()
Definition: iDie.h:571
std::list< std::string > monNames_
Definition: iDie.h:212
xdata::UnsignedInteger32 flashRunNumber_
Definition: iDie.h:209
float getBusyTotalFracTheor(bool procstat, std::vector< float > &machineWeight)
Definition: iDie.h:411
std::vector< std::string > mapmod_
Definition: iDie.h:314
int etimesPassedPs[evf::max_endpaths]
Definition: iDie.h:82
unsigned int cpuLoadReports24_[4000]
Definition: iDie.h:248
MonitorElement * runId_
Definition: iDie.h:285
std::vector< unsigned int > endPathCounts_
Definition: iDie.h:367