3 #include "xdaq/NamespaceURI.h"
5 #include "xdata/InfoSpaceFactory.h"
6 #include "toolbox/task/TimerFactory.h"
8 #include "xoap/SOAPEnvelope.h"
9 #include "xoap/SOAPBody.h"
10 #include "xoap/domutils.h"
12 #include <boost/tokenizer.hpp>
14 #include <netinet/in.h>
21 #include <sys/types.h>
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"
57 : xdaq::Application(s)
58 , log_(getApplicationLogger())
62 , lastRunNumberSet_(0)
70 , cpustat_(std::vector<std::vector<int> >(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)
90 , meInitialized_(
false)
91 , meInitializedStreams_(
false)
92 , meInitializedDatasets_(
false)
100 , dqmFilesWritable_(
true)
101 , topLevelFolder_(
"DAQ")
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");
135 xdata::InfoSpace *ispace = getApplicationInfoSpace();
136 ispace->fireItemAvailable(
"runNumber", &
runNumber_ );
137 getApplicationInfoSpace()->addItemChangedListener(
"runNumber",
this);
141 ispace->fireItemAvailable(
"dqmSaveDir", &
dqmSaveDir_ );
144 ispace->fireItemAvailable(
"dqmEnabled", &
dqmEnabled_ );
145 ispace->fireItemAvailable(
"debugMode", &
debugMode_ );
160 configString_+=
"process.source = cms.Source(\"EmptySource\")\n";
161 configString_+=
"process.DQMStore = cms.Service(\"DQMStore\",\n";
162 configString_+=
" referenceFileName = cms.untracked.string(''),\n";
165 configString_+=
" collateHistograms = 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";
176 epMax = {8, 8, 24, 32, 24, 32};
177 HTscaling = {1, 1, 0.28,0.28, 0.28,0.28};
185 std::map<unsigned int, unsigned int> mptmp;
196 std::string cpuInfoSpaceName=
"filterFarmUsageAndTiming";
197 toolbox::net::URN urn = this->createQualifiedInfoSpace(cpuInfoSpaceName);
198 cpuInfoSpace_ = xdata::getInfoSpaceFactory()->get(urn.toString());
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");
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();
277 timer->scheduleAtFixedRate( timerStart,
this, timerInterval, 0,
"xmas-iDie-producer" );
280 LOG4CPLUS_WARN(getApplicationLogger(), e.what());
294 if (e.type()==
"ItemChangedEvent" ) {
295 std::string item =
dynamic_cast<xdata::ItemChangedEvent&
>(
e).itemName();
297 if ( item ==
"runNumber") {
298 LOG4CPLUS_WARN(getApplicationLogger(),
299 "New Run was started - iDie will reset");
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();
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());
336 if (commandName.empty()) {
344 xoap::MessageReference reply = xoap::createMessage();
345 xoap::SOAPEnvelope envelope = reply->getSOAPPart().getEnvelope();
346 xoap::SOAPName responseName = envelope.createName(commandName+
"Response",
348 xoap::SOAPBodyElement responseElem =
349 envelope.getBody().addBodyElement(responseName);
353 if(commandName ==
"Configure") {dqmState_ =
"Ready"; state =
"Ready";}
354 else if(commandName ==
"Enable" || commandName ==
"Start") {
355 dqmState_ =
"Enabled"; state =
"Enabled";
356 setRunStartTimeStamp();
359 else if(commandName ==
"Stop" || commandName ==
"Halt") {
368 std::cout <<
" Stopping/Halting iDie. command=" << commandName <<
" initialized=" << meInitialized_ << std::endl;
369 if (meInitialized_) {
370 dqmState_ =
"Removed";
372 meInitialized_=
false;
373 meInitializedStreams_=
false;
374 meInitializedDatasets_=
false;
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();
391 if (reportingStart_)
delete reportingStart_;
398 xoap::SOAPName stateName = envelope.createName(
"state",
400 xoap::SOAPElement stateElem = responseElem.addChildElement(stateName);
401 xoap::SOAPName attributeName = envelope.createName(
"stateName",
403 stateElem.addAttribute(attributeName,state);
419 cgicc::Cgicc cgi(
in);
421 if(method ==
"POST"){
422 unsigned int run = 0;
423 std::vector<cgicc::FormEntry> el1 = cgi.getElements();
424 cgi.getElement(
"run",el1);
426 run = el1[0].getIntegerValue();
435 std::ostringstream ost;
437 f_ =
new TFile(ost.str().c_str(),
"RECREATE",
"microreport");
445 std::string hostname = cgi.getEnvironment().getRemoteHost();
447 hostname.begin(), ::toupper);
448 fus_[hostname] = fuinstance;
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\">"
469 *
out <<
"<tr><td>"<<fus_.size()<<
"</td><td>" << totalCores_
470 <<
"</td><td></td></tr>" << std::endl;
479 time_t
now = tv.tv_sec;
480 for(
ifmap i = fus_.begin();
i != fus_.end();
i++)
481 if((*i).second.ccount != 0){
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;
497 cgicc::Cgicc cgi(
in);
499 std::vector<cgicc::FormEntry> el1;
500 cgi.getElement(
"name",el1);
504 hostname.begin(), ::toupper);
505 ifmap fi = fus_.find(hostname);
507 *
out << (*fi).second.stacktraces.back() << std::endl;
510 for(fi=fus_.begin(); fi != fus_.end(); fi++)
511 std::cout <<
"known hosts: " << (*fi).first << std::endl;
522 if(last_ls_==0)
return;
523 *
out <<
"<div id=\"cls\">" << last_ls_ <<
"</div>"
524 <<
"<div id=\"clr\">" << cpuentries_[last_ls_-1] <<
"</div>" << std::endl;
527 *
out <<
"<tbody id=\"cpue\">";
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>";
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";
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++)
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>";
561 for(
int j = 0;
j < trp_[0].endPathsInMenu;
j++)
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>";
569 *
out <<
"</tbody>\n";
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\">"
593 time_t
now = tv.tv_sec;
596 cgicc::Cgicc cgi(
in);
597 unsigned int run = 0;
602 std::vector<cgicc::FormEntry> el1;
603 el1 = cgi.getElements();
607 cgi.getElement(
"run",el1);
610 run = el1[0].getIntegerValue();
613 cgi.getElement(
"stacktrace",el1);
619 if(el1[0].
getValue().find(
"Dead")==0){
623 host.begin(), ::toupper);
624 ifmap fi = fus_.find(host);
648 size_t psig = st.find(
"signal");
649 if(psig != std::string::npos)
650 sig = st.substr(psig,9);
653 host.begin(), ::toupper);
654 ifmap fi = fus_.find(host);
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);
665 cgi.getElement(
"legenda",el1);
668 parsePathLegenda(el1[0].
getValue());
670 cgi.getElement(
"LegendaAux",el1);
673 parseDatasetLegenda(el1[0].
getValue());
675 cgi.getElement(
"trp",el1);
678 unsigned int lsid =
run;
679 parsePathHisto((
unsigned char*)(el1[0].
getValue().c_str()),lsid);
684 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught edm exception in postEntry: " << e.
what());
687 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught cms exception in postEntry: " << e.
what());
690 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught std exception in postEntry: " << e.what());
693 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught unknown exception in postEntry");
704 if (dqmEnabled_.value_) {
705 if (!evtProcessor_) initFramework();
706 if (!meInitialized_) {
707 if (dqmState_!=
"Removed") initMonitorElements();
712 unsigned int lsid = 0;
714 cgicc::Cgicc cgi(
in);
718 std::vector<cgicc::FormEntry> el1;
719 el1 = cgi.getElements();
723 cgi.getElement(
"run",el1);
726 lsid = el1[0].getIntegerValue();
734 if(lsid>cpustat_.size()){
735 cpustat_.resize(lsid,std::vector<int>(nstates_,0));
736 cpuentries_.resize(lsid,0);
738 if(lsid>trp_.size()){
741 trpentries_.resize(lsid,0);
743 if(last_ls_ < lsid) {
746 if(t_ && (last_ls_%10==0)) t_->Write();
750 cgi.getElement(
"legenda",el1);
753 parseModuleLegenda(el1[0].
getValue());
755 cgi.getElement(
"trp",el1);
758 parseModuleHisto(el1[0].
getValue().c_str(),lsid);
764 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught edm exception in postEntryiChoke: " << e.
what());
767 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught cms exception in postEntryiChoke: " << e.
what());
770 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught std exception in postEntryiChoke: " << e.what());
773 LOG4CPLUS_ERROR(getApplicationLogger(),
"Caught unknown exception in postEntryiChoke");
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));
833 int *trp = (
int*)crp;
836 std::ostringstream ost;
839 ost<<
":"<<mapmod_[
i];
840 ost<<
":nsubp:instance:nproc:ncpubusy";
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");
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];
883 gettimeofday(&now, 0);
884 double time_now = now.tv_sec + 1
e-6*now.tv_usec;
913 for (
unsigned int newls=lclast+1;newls<=lsid;newls++) {
918 for (
size_t newls=lhlast+1;newls<=lsid;newls++) {
927 unsigned int qsize=
lsHistory[nbsIdx].size();
929 if (qsize>delta && delta<
ROLL) {
931 unsigned int cumulative_ = 0;
939 unsigned int busyCounts = cumulative_-
datap_[2];
940 lst->
update(busyCounts,datap_[2],nbproc_,ncpubusy_,deltaTms_);
949 t_->SetEntries(
t_->GetEntries()+1);
b_->Fill();
b1_->Fill();
967 boost::char_separator<char> sep(
",");
968 boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
970 for (
boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
971 tok_iter != tokens.end(); ++tok_iter){
974 if (
std::string(*tok_iter).find(
"Output")!=std::string::npos) {
976 if (path_token.find(
"=")!=std::string::npos)
977 endPathNames_.push_back(path_token.substr(path_token.find(
"=")+1));
985 for (
boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
986 tok_iter != tokens.end(); ++tok_iter){
988 if (
std::string(*tok_iter).find(
"output")!=std::string::npos) {
990 if (path_token.find(
"=")!=std::string::npos)
991 endPathNames_.push_back(path_token.substr(path_token.find(
"=")+1));
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) {
1041 if (cst && cst->
ls_>=lsid) {
1043 while (cst->
ls_>lsid && countback) {
1069 LOG4CPLUS_WARN(getApplicationLogger(),
"mismatch in number of datasets! "
1090 b2_ =
t_->Branch(
"rate",&
r_,
"nproc/I:nsub:nrep");
1091 std::ostringstream ost1;
1100 std::ostringstream ost2;
1124 std::string urn = getApplicationDescriptor()->getURN();
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;
1214 configuration_.replace(configuration_.find(
"EMPTYHOST"),9,
dqmCollectorHost_.value_);
1219 std::string::const_iterator it = s.begin();
1220 while (it != s.end() && std::isdigit(*it)) ++it;
1223 configuration_.replace(configuration_.find(
"EMPTYPORT"),9,
dqmCollectorPort_.value_);
1226 boost::shared_ptr<edm::ProcessDesc> pdesc;
1227 std::vector<std::string> defaultServices = {
"InitRootHandlers"};
1229 pdesc->addServices(defaultServices);
1241 LOG4CPLUS_WARN(getApplicationLogger(),
"Unable to create message service presence");
1245 LOG4CPLUS_WARN(getApplicationLogger(),e.
what());
1249 LOG4CPLUS_WARN(getApplicationLogger(),e.
what());
1253 LOG4CPLUS_WARN(getApplicationLogger(),e.what());
1256 LOG4CPLUS_WARN(getApplicationLogger(),
"Unknown Exception (Message Presence)");
1263 LOG4CPLUS_WARN(getApplicationLogger(),
"Failed creation of service token ");
1277 LOG4CPLUS_WARN(getApplicationLogger(),
"exception when trying to get service DQMStore");
1285 LOG4CPLUS_WARN(getApplicationLogger(),
"exception when trying to get service DQMService");
1288 if (!
dqmEnabled_.value_) LOG4CPLUS_ERROR(getApplicationLogger(),
"Failed to initialize DQMService/DQMStore");
1324 std::ostringstream str;
1328 "Average event rate for nodes with " + TString(str.str().c_str()) +
" EP instances",
1331 "Average event processing time for nodes with " + TString(str.str().c_str()) +
" EP instances",
1334 "Average CPU (%) usage for nodes with " + TString(str.str().c_str()) +
" EP instances",
1338 "Module processing time fraction_"+ TString(str.str().c_str()),
1360 std::ostringstream busySummaryTitle;
1361 busySummaryTitle <<
"DAQ HLT Farm busy (%) for run "<<
runNumber_.value_;
1367 for (
size_t i=1;
i<=
ROLL;
i++) {
1368 std::ostringstream ostr;
1380 std::ostringstream ostr;
1450 unsigned int qsize =
lsHistory[nbsIdx].size();
1452 unsigned int cqsize =
lsHistory[nbsIdx].size();
1457 unsigned int qpos=(
unsigned int)
i;
1458 unsigned int forls = lsid - (qsize-1-
i);
1460 unsigned int clsPos = unsigned((
int)qpos+ (
int)cqsize - (
int)qsize);
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);
1466 meVecTime_[nbsIdx]->setBinError(forls>2? forls:0,lst->getEvtTimeErr()*1000);
1467 meVecCPU_[nbsIdx]->setBinContent(forls,lst->getFracBusy()*100.);
1468 meVecCPU_[nbsIdx]->setBinError(forls,0.);
1479 unsigned int lsidBin;
1485 for (
unsigned int i=1;
i<=
ROLL;
i++) {
1487 bool emptyBin=
false;
1488 if (
i>
ROLL-lsdiff) emptyBin=
true;
1503 std::ostringstream ostr;
1504 ostr << lsid-
ROLL+
i;
1515 summaryLastLs_=lsid;
1526 lsidBin=lsid > roll_pos ? roll_pos : lsid;
1540 float busyFrTheor=0;
1541 float busyFrCPUTheor=0;
1545 busyFr=(0.5 + (busyCorr-0.5)*
HTscaling[nbsIdx])/fracMax;
1549 busyFr=busyCorr / fracMax;
1550 busyFrTheor = busyCorr / (0.5+0.5*
HTscaling[nbsIdx]);
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]);
1560 busyCPUFr=busyCorr_CPU / fracMax;
1561 busyFrCPUTheor = busyCorr_CPU / (0.5+0.5*
HTscaling[nbsIdx]);
1571 busyCPUFr=
fround(busyCPUFr,0.001
f);
1572 busyFrTheor=
fround(busyFrTheor,0.001
f);
1573 busyFrCPUTheor=
fround(busyFrCPUTheor,0.001
f);
1574 busyAvg=
fround(busyAvg,0.001
f);
1595 unsigned int lsidBinForFlash = lsidBin;
1597 else lsidBinForFlash=1;
1649 unsigned int count_current=0;
1650 unsigned int count_last=0;
1654 endPathRates_[
i]->setBinContent(forls,(count_current-count_last)/23.1);
1664 unsigned int count_current=0;
1665 unsigned int count_last=0;
1669 datasetRates_[
i]->setBinContent(forls,(count_current-count_last)/23.1);
1674 void iDie::fillDQMModFractionHist(
unsigned int nbsIdx,
unsigned int lsid,
unsigned int nonIdle,
const std::vector<std::pair<unsigned int,unsigned int>>& offenders)
1679 unsigned int xBinToFill=lsid;
1681 for (
unsigned int i=1;
i<=
ROLL;
i++) {
1688 std::ostringstream ostr;
1689 ostr << lsid-
ROLL+
i;
1692 std::ostringstream ostr;
1696 float nonIdleInv=0.;
1697 if (nonIdle>0)nonIdleInv=1./(double)nonIdle;
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) {
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) {
1724 unsigned int toReplace=0;
1728 if (bin<minbinval) {toReplace=
j;minbinval=
bin;}
1730 if (percentageUsed>minbinval && toReplace) {
1733 if (it->second == toReplace-1) {
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);
1831 std::cout <<
"debug - updated lumi flashlist with values "
1844 LOG4CPLUS_WARN(getApplicationLogger(), xe.what() );
1848 std::string msg =
"Caught standard exception while trying to collect: ";
1850 LOG4CPLUS_WARN(getApplicationLogger(), msg );
1854 std::string msg =
"Caught unknown exception while trying to collect";
1855 LOG4CPLUS_WARN(getApplicationLogger(), msg );
1865 std::ostringstream busySummaryTitle;
1866 busySummaryTitle <<
"DAQ HLT Farm busy (%) for run "<<
runNumber_.value_;
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.");
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.");
1892 sprintf(version,
"_V%04d_",
int(1));
1895 if (sDir[sDir.size()-1]!=
'/') sDir+=
"/";
1900 if ( access( sDir.c_str(), 0 ) == 0 )
1903 stat( sDir.c_str(), &
status );
1915 sprintf(suffix,
"_R%09d_L%06d",
runNumber_.value_, lsid);
1920 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i) {
1927 chmod(filename.c_str(),0777);
1935 LOG4CPLUS_ERROR(getApplicationLogger(),
"iDie could not create root file " << filename);
1955 std::ostringstream busySummaryTitle;
1956 busySummaryTitle <<
"DAQ HLT Farm busy (%) for run "<<
runNumber_.value_;
1965 std::vector<unsigned int> minutes = {4,8,12,20};
1976 gettimeofday(&new_ts,0);
1980 unsigned int willSaveForTime = 0;
1982 for (
size_t i=0;
i<minutes.size();
i++) {
1983 if (dT>=minutes[
i]) {
1993 unsigned int lastMinutesTime = minutes[minutes.size()-1];
1994 if (!willSaveForTime && dT>lastMinutesTime)
2006 sprintf(suffix,
"_R%09d",
runNumber_.value_);
2007 sprintf(rewrite,
"\\1Run %d/\\2/Run summary",
runNumber_.value_);
2011 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i) {
2017 chmod(filename.c_str(),0777);
2020 LOG4CPLUS_ERROR(getApplicationLogger(),
"iDie could not create root file " << filename);
2034 gettimeofday(&now, 0);
2035 double time_now = now.tv_sec + 1
e-6*now.tv_usec;
2071 gettimeofday(&now, 0);
2072 double time_now = now.tv_sec + 1
e-6*now.tv_usec;
2080 XDAQ_INSTANTIATOR_IMPL(
iDie)
xdata::Boolean debugMode_
unsigned int cpuLoadReports12_[4000]
static const char runNumber_[]
virtual char const * what() const
xdata::UnsignedInteger32 flashReports16_
std::vector< std::pair< unsigned int, unsigned int > > getOffendersVector()
MonitorElement * daqTotalRateSummary_
unsigned int cpuLoadReports16_[4000]
void updateDatasetHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
timeval runStartDetectedTimeStamp_
std::atomic< unsigned int > cpuLoadSentLs_
xdata::UnsignedInteger32 runNumber_
xdata::Boolean dqmEnabled_
MonitorElement * busySummary2_
timeval lastModuleLegendaMessageTimeStamp_
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hostNameMe_
void setRunStartTimeStamp()
unsigned int summaryLastLs_
std::vector< float > machineWeightInst
xdata::Float flashLoadPS_
xdata::UnsignedInteger32 instance_
void parseDatasetLegenda(std::string)
std::deque< commonLsStat * > commonLsHistory
unsigned int cpuLoadReports7_[4000]
float cpuLoadTime24_[4000]
unsigned int nbSubsClasses
int nModuleLegendaMessageWithDataReceived_
iDie(xdaq::ApplicationStub *s)
void setBusyForClass(unsigned int classIdx, float rate, float busy, float busyTheor, float busyCPU, float busyCPUTheor, unsigned int nMachineReports)
int nPathHistoMessageReceived_
MonitorElement * busySummaryUncorr2_
xdata::UnsignedInteger32 flashLoadLs_
float cpuLoadRate16_[4000]
static PluginManager & configure(const Config &)
MonitorElement * processStartTimeStampMe_
xdata::UnsignedInteger32 flashReports32_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * daqBusySummary_
void updateRollingHistos(unsigned int nbsIdx, unsigned int lsid, lsStat *lst, commonLsStat *clst, bool roll)
xdata::Float flashLoadTime7_
void cd(void)
go to top directory (ie. root)
void parsePathLegenda(std::string)
int etimesRun[evf::max_endpaths]
MonitorElement * workingDirMe_
MonitorElement * daqBusySummary2_
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")
float cpuLoadRate8_[4000]
boost::tokenizer< boost::char_separator< char > > tokenizer
xdata::UnsignedInteger32 flashReports24_
xdata::UnsignedInteger32 saveLsInterval_
std::vector< std::map< unsigned int, unsigned int > > occupancyNameMap
int ptimesFailed[evf::max_paths]
xdata::String dqmCollectorPort_
xdata::Float flashLoadRate12_
timeval * reportingStart_
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)
void initMonitorElementsStreams()
PathSummaryStatic trigPathSummaries[max_paths]
int ptimesPassedPs[evf::max_paths]
void postEntryiChoke(xgi::Input *in, xgi::Output *out)
void perLumiFileSaver(unsigned int lsid)
int nModuleHistoMessageReceived_
int nDatasetLegendaMessageReceived_
edm::EventProcessor * evtProcessor_
int etimesFailed[evf::max_endpaths]
void addToReport(TriggerReportStatic *trs, TriggerReportStatic *trp, unsigned int lumisection)
xdata::Float flashLoadUc32_
std::vector< MonitorElement * > meVecTime_
void iChoke(xgi::Input *in, xgi::Output *out)
void fillDQMStatHist(unsigned int nbsIdx, unsigned int lsid)
MonitorElement * lumisecId_
std::vector< unsigned int > currentLs_
std::vector< MonitorElement * > endPathRates_
std::pair< unsigned int, unsigned int > * getModuleSamplingPtr()
void parseModuleLegenda(std::string)
int ptimesExcept[evf::max_paths]
xdata::Float flashLoadUc12_
MonitorElement * eventId_
std::vector< MonitorElement * > meVecRate_
std::string fileBaseName_
unsigned int getReports()
float getBusyTotalFrac(bool procstat, std::vector< float > &machineWeightInst)
MonitorElement * bookFloat(const char *name)
Book float.
void updater(xgi::Input *in, xgi::Output *out)
unsigned int getNSampledNonIdle()
float cpuLoadTime12_[4000]
void update(unsigned int nSampledNonIdle, unsigned int nSampledIdle, unsigned int nProc, unsigned int ncpubusy, unsigned int deltaTms)
bool meInitializedStreams_
std::vector< unsigned int > datasetCounts_
unsigned int cpuLoadReports8_[4000]
std::vector< int > cpuentries_
std::vector< unsigned int > epMax
MonitorElement * cmsswVerMe_
unsigned int lastSavedForTime_
std::vector< int > trpentries_
int nModuleLegendaMessageReceived_
PluginManager::Config config()
void fillDQMModFractionHist(unsigned int nbsIdx, unsigned int lsid, unsigned int nonIdle, const std::vector< std::pair< unsigned int, unsigned int >> &offenders)
float fround(float val, float mod)
std::vector< TriggerReportStatic > trp_
void spotlight(xgi::Input *in, xgi::Output *out)
std::vector< std::vector< int > > cpustat_
xdata::Float flashLoadTime32_
xdata::Float flashLoadRate32_
const T & max(const T &a, const T &b)
xdata::Float flashLoadUc8_
float cpuLoadTime7_[4000]
MonitorElement * processLatencyMe_
MonitorElement * processNameMe_
MonitorElement * bookString(const char *name, const char *value)
Book string.
xdata::Float flashLoadUc24_
DatasetSummaryStatic datasetSummaries[max_datasets]
xdata::UnsignedInteger32 flashReports12_
void updateStreamHistos(unsigned int forls, commonLsStat *clst, commonLsStat *prevclst)
void reset(TriggerReportStatic *)
xdata::Float flashLoadTime24_
int etimesPassedL1[evf::max_endpaths]
xdata::UnsignedInteger32 flashReports8_
MonitorElement * processIdMe_
xoap::MessageReference fsmCallback(xoap::MessageReference msg)
PathSummaryStatic endPathSummaries[max_endpaths]
int etimesPassed[evf::max_endpaths]
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
unsigned int cpuLoadReports32_[4000]
MonitorElement * eventTimeStamp_
std::atomic< unsigned int > cpuLoadLastLs_
static ServiceToken createSet(std::vector< ParameterSet > &)
void actionPerformed(xdata::Event &e)
MonitorElement * timingSummary_
xdata::Float flashLoadUc7_
void detailsTable(xgi::Input *in, xgi::Output *out)
std::vector< MonitorElement * > meVecCPU_
void timeExpired(toolbox::task::TimerEvent &e)
void postEntry(xgi::Input *in, xgi::Output *out)
bool writeDirectoryPresent_
unsigned int getNReports()
float cpuLoadRate32_[4000]
xdata::Float flashLoadRate16_
int etimesExcept[evf::max_endpaths]
xdata::Float flashLoadTime16_
MonitorElement * rateSummary_
MonitorElement * busySummary_
float cpuLoadRate12_[4000]
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
void parsePathHisto(const unsigned char *, unsigned int)
MonitorElement * busySummaryUncorr1_
std::string getReleaseVersion()
static PresenceFactory * get()
int ptimesPassedL1[evf::max_paths]
std::vector< std::string > datasetNames_
void dumpTable(xgi::Input *in, xgi::Output *out)
void initMonitorElements()
timeval lastPathLegendaMessageTimeStamp_
int nDatasetLegendaMessageWithDataReceived_
xdata::InfoSpace * cpuInfoSpace_
std::vector< float > HTscaling
std::vector< float > machineWeight
std::vector< unsigned int > epInstances
std::map< int, unsigned int > nbSubsListInv
xdata::String dqmCollectorHost_
std::vector< MonitorElement * > datasetRates_
void defaultWeb(xgi::Input *in, xgi::Output *out)
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)
xdata::UnsignedInteger32 flashReports7_
std::vector< std::string > mappath_
MonitorElement * processTimeStampMe_
std::vector< std::string > endPathNames_
xdata::Float flashLoadTime8_
void initMonitorElementsDatasets()
int nPathLegendaMessageWithDataReceived_
float cpuLoadRate24_[4000]
MonitorElement * reportPeriodSummary_
xdata::Float flashLoadRate_
std::vector< std::vector< double > > tmp
MonitorElement * nUpdatesMe_
xdata::String dqmSaveDir_
double getBinContent(int binx) const
get content of bin (1-D)
boost::shared_ptr< std::vector< edm::ParameterSet > > pServiceSets_
float cpuLoadTime32_[4000]
int nPathLegendaMessageReceived_
edm::ServiceToken serviceToken_
void parseModuleHisto(const char *, unsigned int)
std::vector< MonitorElement * > meVecOffenders_
float cpuLoadTime16_[4000]
MonitorElement * processEventsMe_
TriggerReportStatic * trppriv_
void summaryTable(xgi::Input *in, xgi::Output *out)
xdata::String topLevelFolder_
MonitorElement * fuReportsSummary_
xdata::Float flashLoadRate24_
static const int STATUS_OK
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
timeval lastDatasetLegendaMessageTimeStamp_
MonitorElement * processEventRateMe_
xdata::Float flashLoadRate7_
xdata::Float flashLoadUc16_
float cpuLoadRate7_[4000]
edm::EventSummary eventSummary
std::deque< lsStat * > * lsHistory
bool meInitializedDatasets_
MonitorElement * runStartTimeStamp_
MonitorElement * bookInt(const char *name)
Book int.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
xdata::Float flashLoadTime12_
xdata::Float flashLoadRate8_
unsigned int lastRunNumberSet_
xdata::Boolean dqmFilesWritable_
void reset(double vett[256])
std::map< unsigned int, int > nbSubsList
int ptimesPassed[evf::max_paths]
float cpuLoadTime8_[4000]
tuple size
Write out results.
std::string configString_
void setCurrentFolder(const std::string &fullpath)
std::list< std::string > pastSavedFiles_
int ptimesRun[evf::max_paths]
std::list< std::string > monNames_
xdata::UnsignedInteger32 flashRunNumber_
float getBusyTotalFracTheor(bool procstat, std::vector< float > &machineWeight)
std::vector< std::string > mapmod_
int etimesPassedPs[evf::max_endpaths]
unsigned int cpuLoadReports24_[4000]
std::vector< unsigned int > endPathCounts_