CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

evf::iDie Class Reference

#include <iDie.h>

List of all members.

Classes

struct  sorted_indices

Public Member Functions

void actionPerformed (xdata::Event &e)
void defaultWeb (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void detailsTable (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void dumpTable (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
xoap::MessageReference fsmCallback (xoap::MessageReference msg) throw (xoap::exception::Exception)
void iChoke (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void iChokeMiniInterface (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
 iDie (xdaq::ApplicationStub *s)
void postEntry (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void postEntryiChoke (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void spotlight (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void summaryTable (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
void updater (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
 XDAQ_INSTANTIATOR ()
virtual ~iDie ()

Private Member Functions

void parseModuleHisto (const char *, unsigned int)
void parseModuleLegenda (std::string)
void parsePathHisto (const unsigned char *, unsigned int)
void parsePathLegenda (std::string)
void reset ()

Private Attributes

TBranch * b1_
TBranch * b2_
TBranch * b3_
TBranch * b4_
TBranch * b_
xdata::String class_
xdata::String configString_
std::vector< int > cpuentries_
std::vector< std::vector< int > > cpustat_
int * datap_
TFile * f_
fmap fus_
xdata::String hostname_
xdata::UnsignedInteger32 instance_
unsigned int last_ls_
timeval lastModuleLegendaMessageTimeStamp_
timeval lastPathLegendaMessageTimeStamp_
Logger log_
std::vector< std::string > mapmod_
std::vector< std::string > mappath_
int nModuleHistoMessageReceived_
int nModuleLegendaMessageReceived_
int nModuleLegendaMessageWithDataReceived_
int nPathHistoMessageReceived_
int nPathLegendaMessageReceived_
int nPathLegendaMessageWithDataReceived_
unsigned int nstates_
internal::rate r_
xdata::UnsignedInteger32 runNumber_
timeval runStartDetectedTimeStamp_
TTree * t_
unsigned int totalCores_
std::vector< TriggerReportStatictrp_
std::vector< int > trpentries_
TriggerReportStatictrppriv_
xdata::String url_

Detailed Description

Definition at line 68 of file iDie.h.


Constructor & Destructor Documentation

iDie::iDie ( xdaq::ApplicationStub *  s)

Definition at line 36 of file iDie.cc.

References class_, configString_, defaultWeb(), detailsTable(), dumpTable(), fsmCallback(), hostname_, iChoke(), iChokeMiniInterface(), instance_, lastModuleLegendaMessageTimeStamp_, lastPathLegendaMessageTimeStamp_, postEntry(), postEntryiChoke(), runNumber_, runStartDetectedTimeStamp_, spotlight(), summaryTable(), updater(), and url_.

  : xdaq::Application(s)
  , log_(getApplicationLogger())
  , instance_(0)
  , runNumber_(0)
  , totalCores_(0)
  , nstates_(0)
  , cpustat_(std::vector<std::vector<int> >(0))
  , last_ls_(0)
  , f_(0)
  , t_(0)
  , b_(0)
  , b1_(0)
  , b2_(0)
  , b3_(0)
  , b4_(0)
  , datap_(0)
  , trppriv_(0)
  , nModuleLegendaMessageReceived_(0)
  , nPathLegendaMessageReceived_(0)
  , nModuleLegendaMessageWithDataReceived_(0)
  , nPathLegendaMessageWithDataReceived_(0)
  , nModuleHistoMessageReceived_(0)
  , nPathHistoMessageReceived_(0)
{
  // initialize application info
  url_     =
    getApplicationDescriptor()->getContextDescriptor()->getURL()+"/"+
    getApplicationDescriptor()->getURN();
  class_   =getApplicationDescriptor()->getClassName();
  instance_=getApplicationDescriptor()->getInstance();
  hostname_=getApplicationDescriptor()->getContextDescriptor()->getURL();
  getApplicationDescriptor()->setAttribute("icon", "/evf/images/idieapp.jpg");

  
  //soap interface
  xoap::bind(this,&evf::iDie::fsmCallback,"Configure",XDAQ_NS_URI);
  xoap::bind(this,&evf::iDie::fsmCallback,"Enable",   XDAQ_NS_URI);
  xoap::bind(this,&evf::iDie::fsmCallback,"Stop",     XDAQ_NS_URI);
  xoap::bind(this,&evf::iDie::fsmCallback,"Halt",     XDAQ_NS_URI);

  // web interface
  xgi::bind(this,&evf::iDie::defaultWeb,               "Default");
  xgi::bind(this,&evf::iDie::summaryTable,             "summary");
  xgi::bind(this,&evf::iDie::detailsTable,             "details");
  xgi::bind(this,&evf::iDie::dumpTable,                "dump"   );
  xgi::bind(this,&evf::iDie::updater,                  "updater");
  xgi::bind(this,&evf::iDie::iChoke,                   "iChoke" );
  xgi::bind(this,&evf::iDie::iChokeMiniInterface,      "iChokeMiniInterface" );
  xgi::bind(this,&evf::iDie::spotlight,                "Spotlight" );
  xgi::bind(this,&evf::iDie::postEntry,                "postEntry");
  xgi::bind(this,&evf::iDie::postEntryiChoke,          "postChoke");
  //  gui_->setSmallAppIcon("/evf/images/Hilton.gif");
  //  gui_->setLargeAppIcon("/evf/images/Hilton.gif");

  xdata::InfoSpace *ispace = getApplicationInfoSpace();
  ispace->fireItemAvailable("parameterSet",         &configString_                );
  ispace->fireItemAvailable("runNumber",            &runNumber_                   );
  getApplicationInfoSpace()->addItemChangedListener("runNumber",              this);

  // timestamps
  lastModuleLegendaMessageTimeStamp_.tv_sec=0;
  lastModuleLegendaMessageTimeStamp_.tv_usec=0;
  lastPathLegendaMessageTimeStamp_.tv_sec=0;
  lastPathLegendaMessageTimeStamp_.tv_usec=0;
  runStartDetectedTimeStamp_.tv_sec=0;
  runStartDetectedTimeStamp_.tv_usec=0;
}
iDie::~iDie ( ) [virtual]

Definition at line 107 of file iDie.cc.

{
}

Member Function Documentation

void iDie::actionPerformed ( xdata::Event &  e)

Definition at line 112 of file iDie.cc.

References reset().

{
  
  if (e.type()=="ItemChangedEvent" ) {
    std::string item = dynamic_cast<xdata::ItemChangedEvent&>(e).itemName();
    
    if ( item == "runNumber") {
      LOG4CPLUS_WARN(getApplicationLogger(),
                     "New Run was started - iDie will reset");
      reset();
    }
    
  }
}
void iDie::defaultWeb ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 189 of file iDie.cc.

References evf::internal::fu::ccount, recoMuon::in, dbtoconf::out, reset(), DTTTrigCorrFirst::run, and sistrip::runNumber_.

Referenced by iDie().

{
  cgicc::Cgicc cgi(in);
  std::string method = cgi.getEnvironment().getRequestMethod();
  if(method == "POST"){
    unsigned int run = 0;
    std::vector<cgicc::FormEntry> el1 = cgi.getElements();
    cgi.getElement("run",el1);
    if(el1.size()!=0){
      run = el1[0].getIntegerValue();
      if(run > runNumber_.value_ || runNumber_.value_==0){
        runNumber_.value_ = run;
        if(runNumber_.value_!=0) 
          {
            reset();
            if(f_ == 0)
              {
                std::ostringstream ost;
                ost << "microReport"<<runNumber_<<".root";
                f_ = new TFile(ost.str().c_str(),"RECREATE","microreport");
              }
          }
      }
    }
    internal::fu fuinstance;

    fuinstance.ccount = 0;
    std::string hostname = cgi.getEnvironment().getRemoteHost();
    std::transform(hostname.begin(), hostname.end(),
                   hostname.begin(), ::toupper);
    fus_[hostname] = fuinstance;
  }
  else{
    *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" 
         << "<html><head><title>" << getApplicationDescriptor()->getClassName()
         << getApplicationDescriptor()->getInstance() << "</title>"
         << "<meta https-equiv=\"REFRESH\" content=\"0;url=/evf/html/idiePage.html\">"
         << "</head></html>";
  }
}
void iDie::detailsTable ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 246 of file iDie.cc.

References i, cmsPerfSuiteHarvest::now, and dbtoconf::out.

Referenced by iDie().

{
  timeval tv;
  gettimeofday(&tv,0);
  time_t now = tv.tv_sec;
  for(ifmap i = fus_.begin(); i != fus_.end(); i++)
    if((*i).second.ccount != 0){
      *out << "<tr><td " 
           << (now-(*i).second.tstamp<300 ? "style=\"background-color:red\"" : "")
           << ">"<<(*i).first<<"</td><td>" 
           << (*i).second.ccount << "</td>"
           << "<td onClick=loaddump(\'" << url_.value_ << "/dump?name="
           << (*i).first << "\')>" << (*i).second.cpids.back()
           << "</td><td>" <<(*i).second.signals.back() 
           << "</td></tr>" << std::endl;
    }
}
void iDie::dumpTable ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 266 of file iDie.cc.

References gather_cfg::cout, recoMuon::in, and dbtoconf::out.

Referenced by iDie().

{
  cgicc::Cgicc cgi(in); 

  std::vector<cgicc::FormEntry> el1;
  cgi.getElement("name",el1);
  if(el1.size()!=0){
    std::string hostname = el1[0].getValue();
    std::transform(hostname.begin(), hostname.end(),
                   hostname.begin(), ::toupper);
    ifmap fi = fus_.find(hostname);    
    if(fi!=fus_.end()){
      *out << (*fi).second.stacktraces.back() << std::endl;
    }
    else{ 
      for(fi=fus_.begin(); fi != fus_.end(); fi++) 
        std::cout << "known hosts: " << (*fi).first << std::endl;
    }
  }
}
xoap::MessageReference iDie::fsmCallback ( xoap::MessageReference  msg) throw (xoap::exception::Exception)

Definition at line 128 of file iDie.cc.

References edmPickEvents::command, Exception, i, MatrixRunner::msg, python::Node::node, and evf::utils::state.

Referenced by iDie().

{
  
  xoap::SOAPPart     part    =msg->getSOAPPart();
  xoap::SOAPEnvelope env     =part.getEnvelope();
  xoap::SOAPBody     body    =env.getBody();
  DOMNode           *node    =body.getDOMNode();
  DOMNodeList       *bodyList=node->getChildNodes();
  DOMNode           *command =0;
  std::string             commandName;
  
  for (unsigned int i=0;i<bodyList->getLength();i++) {
    command = bodyList->item(i);
    if(command->getNodeType() == DOMNode::ELEMENT_NODE) {
      commandName = xoap::XMLCh2String(command->getLocalName());
      break;
    }
  }
  
  if (commandName.empty()) {
    XCEPT_RAISE(xoap::exception::Exception,"Command not found.");
  }
  
  // fire appropriate event and create according response message
  try {

    // response string
    xoap::MessageReference reply = xoap::createMessage();
    xoap::SOAPEnvelope envelope  = reply->getSOAPPart().getEnvelope();
    xoap::SOAPName responseName  = envelope.createName(commandName+"Response",
                                                       "xdaq",XDAQ_NS_URI);
    xoap::SOAPBodyElement responseElem =
      envelope.getBody().addBodyElement(responseName);
    
    std::string state;
    // generate correct return state string
    if(commandName == "Configure") state = "Ready";
    else if(commandName == "Enable") state = "Enabled";
    else if(commandName == "Stop") state = "Ready";
    else if(commandName == "Halt") state = "Halted";
    else state = "BOH";

    xoap::SOAPName    stateName     = envelope.createName("state",
                                                          "xdaq",XDAQ_NS_URI);
    xoap::SOAPElement stateElem     = responseElem.addChildElement(stateName);
    xoap::SOAPName    attributeName = envelope.createName("stateName",
                                                          "xdaq",XDAQ_NS_URI);
    stateElem.addAttribute(attributeName,state);
    
    return reply;
  }
  catch (toolbox::fsm::exception::Exception & e) {
    XCEPT_RETHROW(xoap::exception::Exception,"invalid command.",e);
  }     
  


}
void iDie::iChoke ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 345 of file iDie.cc.

References dbtoconf::out.

Referenced by iDie().

{
    *out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" 
         << "<html><head><title>" << getApplicationDescriptor()->getClassName()
         << getApplicationDescriptor()->getInstance() << "</title>"
         << "<meta https-equiv=\"REFRESH\" content=\"0;url=/evf/html/ichokePage.html\">"
         << "</head></html>";



}
void iDie::iChokeMiniInterface ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 289 of file iDie.cc.

References begin, i, evf::iDie::sorted_indices::ii(), j, dbtoconf::out, and tmp.

Referenced by iDie().

{
  unsigned int i = 0;

  if(last_ls_==0) return; //wait until at least one complete cycle so we have all arrays sized correctly !!!
  *out << "<div id=\"cls\">" << last_ls_ << "</div>" 
       << "<div id=\"clr\">" << cpuentries_[last_ls_-1] << "</div>" << std::endl;
  sorted_indices tmp(cpustat_[last_ls_-1]);
  //  std::sort(tmp.begin(),tmp.end());// figure out how to remap indices of legenda
  *out << "<tbody id=\"cpue\">";
  while(i<nstates_){
    if(tmp[i]!=0) *out << "<tr><td>" << mapmod_[tmp.ii(i)] << "</td>" << "<td>" 
                       << float(tmp[i])/float(cpuentries_[last_ls_-1]) << "</td></tr>";
    i++;
  }
  *out << "</tbody>\n";
  *out << "<tbody id=\"cpui\"><tr><td></td>";
  unsigned int begin = last_ls_<5 ? 0 : last_ls_-5;
  for(i=begin; i < last_ls_; i++)
    *out << "<td>" << i +1 << "</td>";
  *out << "</tr><tr><td></td>";
  for(i=begin; i < last_ls_; i++)
    *out << "<td>" << float(cpustat_[i][2])/float(cpuentries_[i]) << "</td>";
  *out << "</tr></tbody>\n";

  *out << "<tbody id=\"rate\"><tr><td></td>";
  begin = last_ls_<5 ? 0 : last_ls_-5;
  for(i=begin; i < last_ls_; i++)
    *out << "<td>" << float(trp_[i].eventSummary.totalEventsPassed)/float(trp_[i].eventSummary.totalEvents) << "</td>"; 
  *out << "</tr>\n<tr><td></td>";
  for(i=begin; i < last_ls_; i++)
    *out << "<td>" << trp_[i].eventSummary.totalEvents << "</td>"; 
  *out << "</tr>\n<tr><td></td>";
  for(int j = 0; j < trp_[0].trigPathsInMenu; j++)
    {
      *out << "<tr><td></td>";
      for(i=begin; i < last_ls_; i++)
        *out << "<td>" << trp_[i].trigPathSummaries[j].timesPassed << "("
             << trp_[i].trigPathSummaries[j].timesPassedL1 << ")("
             << trp_[i].trigPathSummaries[j].timesPassedPs << ")</td>";
      *out << "<td>" << mappath_[j] << "</td>";
      *out << "</tr>\n";
    }
  for(int j = 0; j < trp_[0].endPathsInMenu; j++)
    {
      *out << "<tr><td></td>";
      for(i=begin; i < last_ls_; i++)
        *out << "<td>" << trp_[i].endPathSummaries[j].timesPassed << "</td>";
      *out << "<td>" << mappath_[j+trp_[last_ls_-1].trigPathsInMenu] << "</td>";
      *out << "</tr>\n";
    }
  *out << "</tbody>\n";
}
void iDie::parseModuleHisto ( const char *  crp,
unsigned int  lsid 
) [private]

Definition at line 543 of file iDie.cc.

References b1_, b_, cpuentries_, cpustat_, datap_, f_, i, mapmod_, nModuleHistoMessageReceived_, nstates_, and t_.

{
  if(lsid==0) return;
  nModuleHistoMessageReceived_++;
  int *trp = (int*)crp;
  if(t_==0 && f_!=0){
    datap_ = new int[nstates_+3];
    std::ostringstream ost;
    ost<<mapmod_[0]<<"/I";
    for(unsigned int i = 1; i < nstates_; i++)
      ost<<":"<<mapmod_[i];
    ost<<":nsubp:instance:nproc";
    f_->cd();
    t_ = new TTree("microReport","microstate report tree");
    t_->SetAutoSave(500000);
    b_ = t_->Branch("microstates",datap_,ost.str().c_str());
    b1_ = t_->Branch("ls",&lsid,"ls/I");
  }
  memcpy(datap_,trp,(nstates_+3)*sizeof(int));
  if(t_!=0){
    t_->SetEntries(t_->GetEntries()+1); b_->Fill(); b1_->Fill();
  }

  for(unsigned int i=0;i<nstates_; i++)
    {
      cpustat_[lsid-1][i] += trp[i];
      cpuentries_[lsid-1] += trp[i];
    }
}
void iDie::parseModuleLegenda ( std::string  leg) [private]

Definition at line 522 of file iDie.cc.

References lastModuleLegendaMessageTimeStamp_, mapmod_, nModuleLegendaMessageReceived_, nModuleLegendaMessageWithDataReceived_, nstates_, and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

{
  nModuleLegendaMessageReceived_++;
  if(leg=="") return;
  gettimeofday(&lastModuleLegendaMessageTimeStamp_,0);
  nModuleLegendaMessageWithDataReceived_++;
  mapmod_.clear();
  //  if(cpustat_) delete cpustat_;
  boost::char_separator<char> sep(",");
  boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
       tok_iter != tokens.end(); ++tok_iter){
    mapmod_.push_back((*tok_iter));
  }
  nstates_ = mapmod_.size();
  //  cpustat_ = new int[nstates_];
//   for(int i = 0; i < nstates_; i++)
//     cpustat_[i]=0;   
//   cpuentries_ = 0;
}
void iDie::parsePathHisto ( const unsigned char *  crp,
unsigned int  lsid 
) [private]

Definition at line 589 of file iDie.cc.

References evf::funcs::addToReport(), b2_, b3_, b4_, evf::TriggerReportStatic::endPathsInMenu, evf::TriggerReportStatic::endPathSummaries, evf::internal::rate::etimesExcept, evf::internal::rate::etimesFailed, evf::internal::rate::etimesPassed, evf::internal::rate::etimesPassedL1, evf::internal::rate::etimesPassedPs, evf::internal::rate::etimesRun, evf::TriggerReportStatic::eventSummary, f_, i, evf::TriggerReportStatic::nbExpected, evf::TriggerReportStatic::nbReporting, nPathHistoMessageReceived_, evf::internal::rate::nproc, evf::internal::rate::nrep, evf::internal::rate::nsub, evf::internal::rate::ptimesExcept, evf::internal::rate::ptimesFailed, evf::internal::rate::ptimesPassed, evf::internal::rate::ptimesPassedL1, evf::internal::rate::ptimesPassedPs, evf::internal::rate::ptimesRun, r_, t_, evf::PathSummaryStatic::timesExcept, evf::PathSummaryStatic::timesFailed, evf::PathSummaryStatic::timesPassed, evf::PathSummaryStatic::timesPassedL1, evf::PathSummaryStatic::timesPassedPs, evf::PathSummaryStatic::timesRun, edm::EventSummary::totalEvents, evf::TriggerReportStatic::trigPathsInMenu, evf::TriggerReportStatic::trigPathSummaries, trp_, trpentries_, and trppriv_.

{
  if(lsid==0) return;
  nPathHistoMessageReceived_++;
//   if(lsid>=trp_.size()){
//     trp_.resize(lsid);
//     funcs::reset(&trp_[lsid-1]);
//     trpentries_.resize(lsid,0);
//   }
  trppriv_ = (TriggerReportStatic*)crp;
  for( int i=0; i< trppriv_->trigPathsInMenu; i++)
    {
      r_.ptimesRun[i] = trppriv_->trigPathSummaries[i].timesRun;
      r_.ptimesPassedPs[i] = trppriv_->trigPathSummaries[i].timesPassedPs;
      r_.ptimesPassedL1[i] = trppriv_->trigPathSummaries[i].timesPassedL1;
      r_.ptimesPassed[i] = trppriv_->trigPathSummaries[i].timesPassed;
      r_.ptimesFailed[i] = trppriv_->trigPathSummaries[i].timesFailed;
      r_.ptimesExcept[i] = trppriv_->trigPathSummaries[i].timesExcept;
    }
  for( int i=0; i< trppriv_->endPathsInMenu; i++)
    {
      r_.etimesRun[i] = trppriv_->endPathSummaries[i].timesRun;
      r_.etimesPassedPs[i] = trppriv_->endPathSummaries[i].timesPassedPs;
      r_.etimesPassedL1[i] = trppriv_->endPathSummaries[i].timesPassedL1;
      r_.etimesPassed[i] = trppriv_->endPathSummaries[i].timesPassed;
      r_.etimesFailed[i] = trppriv_->endPathSummaries[i].timesFailed;
      r_.etimesExcept[i] = trppriv_->endPathSummaries[i].timesExcept;
    }
  r_.nproc = trppriv_->eventSummary.totalEvents;
  r_.nsub = trppriv_->nbExpected;
  r_.nrep = trppriv_->nbReporting;

  if(t_!=0 && f_!=0 && b2_==0){

    b2_ = t_->Branch("rate",&r_,"nproc/I:nsub:nrep");
    std::ostringstream ost1;
    ost1 << "p_nrun[" << trppriv_->trigPathsInMenu
         << "]/I:p_npps[" << trppriv_->trigPathsInMenu
         << "]:p_npl1[" << trppriv_->trigPathsInMenu
         << "]:p_npp[" << trppriv_->trigPathsInMenu 
         << "]:p_npf[" << trppriv_->trigPathsInMenu
         << "]:p_npe[" << trppriv_->trigPathsInMenu <<"]";

    b3_ = t_->Branch("paths",r_.ptimesRun,ost1.str().c_str());
    std::ostringstream ost2;
    ost2 << "ep_nrun[" << trppriv_->endPathsInMenu
         << "]/I:en_npps[" << trppriv_->endPathsInMenu
         << "]:ep_npl1[" << trppriv_->endPathsInMenu
         << "]:ep_npp[" << trppriv_->endPathsInMenu
         << "]:ep_npf[" << trppriv_->endPathsInMenu
         << "]:ep_npe[" << trppriv_->endPathsInMenu << "]";
    b4_ = t_->Branch("endpaths",r_.etimesRun,ost2.str().c_str());
  }
  if(b2_!=0) b2_->Fill();
  if(b3_!=0) b3_->Fill();
  if(b4_!=0) b4_->Fill();

  funcs::addToReport(&trp_[lsid-1],trppriv_,lsid);
  trpentries_[lsid-1]++;
}
void iDie::parsePathLegenda ( std::string  leg) [private]

Definition at line 574 of file iDie.cc.

References lastPathLegendaMessageTimeStamp_, mappath_, nPathLegendaMessageReceived_, nPathLegendaMessageWithDataReceived_, and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

{
  nPathLegendaMessageReceived_++;
  if(leg=="")return;
  gettimeofday(&lastPathLegendaMessageTimeStamp_,0);
  nPathLegendaMessageWithDataReceived_++;
  mappath_.clear();
  boost::char_separator<char> sep(",");
  boost::tokenizer<boost::char_separator<char> > tokens(leg, sep);
  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
       tok_iter != tokens.end(); ++tok_iter){
      mappath_.push_back((*tok_iter));
  }
}
void iDie::postEntry ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 359 of file iDie.cc.

References reco::JetExtendedAssociation::getValue(), query::host, recoMuon::in, cmsPerfSuiteHarvest::now, and DTTTrigCorrFirst::run.

Referenced by iDie().

{
  timeval tv;
  gettimeofday(&tv,0);
  time_t now = tv.tv_sec;
  cgicc::Cgicc cgi(in); 
  unsigned int run = 0;
  pid_t cpid = 0;
  /*  cgicc::CgiEnvironment cgie(in);
  cout << "query = "  << cgie.getContentLength() << endl;
  */
  std::vector<cgicc::FormEntry> el1;
  el1 = cgi.getElements();
//   for(unsigned int i = 0; i < el1.size(); i++)
//     std::cout << "name="<<el1[i].getName() << std::endl;
  el1.clear();
  cgi.getElement("run",el1);
  if(el1.size()!=0)
    {
      run =  el1[0].getIntegerValue();
    }
  el1.clear();
  cgi.getElement("stacktrace",el1);
  if(el1.size()!=0)
    {
      cpid = run;
      //      std::cout << "=============== stacktrace =============" << std::endl;
      //      std::cout << el1[0].getValue() << std::endl;
      if(el1[0].getValue().find("Dead")==0){

        std::string host = cgi.getEnvironment().getRemoteHost();
        std::transform(host.begin(), host.end(),
                       host.begin(), ::toupper);
        ifmap fi = fus_.find(host);
        if(fi!=fus_.end()){
          fus_.erase(fi);
        }
        if(fus_.size()==0) //close the root file if we know the run is over 
          if(f_!=0){
            f_->cd();
            f_->Write();
            f_->Close();
            t_ = 0;
            delete f_; f_ = 0;
          }
      }
      else{
        totalCores_++;
        std::string st = el1[0].getValue();
        std::string sig; 
        size_t psig = st.find("signal");
        if(psig != std::string::npos)
          sig = st.substr(psig,9);
        std::string host = cgi.getEnvironment().getRemoteHost();
        std::transform(host.begin(), host.end(),
                       host.begin(), ::toupper);
        ifmap fi = fus_.find(host);
        if(fi!=fus_.end()){
          (*fi).second.tstamp = now;
          (*fi).second.ccount++;
          (*fi).second.cpids.push_back(cpid);
          (*fi).second.signals.push_back(sig);
          (*fi).second.stacktraces.push_back(st);
        }
      }
    }
  el1.clear();
  cgi.getElement("legenda",el1);
  if(el1.size()!=0)
    {
      parsePathLegenda(el1[0].getValue());
    }
  cgi.getElement("trp",el1);
  if(el1.size()!=0)
    {
      unsigned int lsid = run;
      parsePathHisto((unsigned char*)(el1[0].getValue().c_str()),lsid);
    }
  el1.clear();


}
void iDie::postEntryiChoke ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 444 of file iDie.cc.

References reco::JetExtendedAssociation::getValue(), recoMuon::in, and evf::funcs::reset().

Referenced by iDie().

{
  //  std::cout << "postEntryiChoke " << std::endl;
  unsigned int lsid = 0;
  cgicc::Cgicc cgi(in); 
  /*  cgicc::CgiEnvironment cgie(in);
  cout << "query = "  << cgie.getContentLength() << endl;
  */
  std::vector<cgicc::FormEntry> el1;
  el1 = cgi.getElements();
//   for(unsigned int i = 0; i < el1.size(); i++)
//     std::cout << "name="<<el1[i].getName() << std::endl;
  el1.clear();
  cgi.getElement("run",el1);
  if(el1.size()!=0)
    {
      lsid =  el1[0].getIntegerValue();
    }
  el1.clear();

  //with the first message for the new lsid, resize all containers so 
  // a web access won't address an invalid location in case it interleaves between 
  // the first cpustat update and the first scalers update or viceversa
  if(lsid!=0){
    if(lsid>cpustat_.size()){
      cpustat_.resize(lsid,std::vector<int>(nstates_,0));
      cpuentries_.resize(lsid,0);
    }
    if(lsid>trp_.size()){
      trp_.resize(lsid);
      funcs::reset(&trp_[lsid-1]);
      trpentries_.resize(lsid,0);
    }
    if(last_ls_ < lsid) {
      last_ls_ = lsid; 
      funcs::reset(&trp_[lsid-1]);
      if(t_ && (last_ls_%10==0)) t_->Write();
    } 
  }

  cgi.getElement("legenda",el1);
  if(el1.size()!=0)
    {
      parseModuleLegenda(el1[0].getValue());
    }
  cgi.getElement("trp",el1);
  if(el1.size()!=0)
    {
      parseModuleHisto(el1[0].getValue().c_str(),lsid);
    }
  el1.clear();
}
void iDie::reset ( void  ) [private]

Definition at line 499 of file iDie.cc.

References b1_, b2_, b3_, b4_, b_, cpuentries_, cpustat_, datap_, f_, fus_, last_ls_, t_, totalCores_, trp_, and trpentries_.

Referenced by actionPerformed().

{
  fus_.erase(fus_.begin(),fus_.end());
  totalCores_=0;
  last_ls_ = 0;
  trp_.clear();
  trpentries_.clear();
  cpustat_.clear();
  cpuentries_.clear();
  if(f_!=0){
    f_->cd();
    f_->Write();
    f_->Close();
    delete f_; f_ = 0;
  }
  if(t_ != 0)
    {delete t_; t_=0;}
  if(datap_ != 0)
    {delete datap_; datap_ = 0;}
  b_=0; b1_=0; b2_=0; b3_=0; b4_=0;

}
void iDie::spotlight ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 652 of file iDie.cc.

References dbtoconf::out.

Referenced by iDie().

{

  std::string urn = getApplicationDescriptor()->getURN();

  *out << "<!-- base href=\"/" <<  urn
       << "\"> -->" << std::endl;
  *out << "<html>"                                                   << std::endl;
  *out << "<head>"                                                   << std::endl;
  *out << "<link type=\"text/css\" rel=\"stylesheet\"";
  *out << " href=\"/evf/html/styles.css\"/>"                   << std::endl;
  *out << "<title>" << getApplicationDescriptor()->getClassName() 
       << getApplicationDescriptor()->getInstance() 
       << " MAIN</title>"     << std::endl;
  *out << "</head>"                                                  << std::endl;
  *out << "<body>"                                                   << std::endl;
  *out << "<table border=\"0\" width=\"100%\">"                      << std::endl;
  *out << "<tr>"                                                     << std::endl;
  *out << "  <td align=\"left\">"                                    << std::endl;
  *out << "    <img"                                                 << std::endl;
  *out << "     align=\"middle\""                                    << std::endl;
  *out << "     src=\"/evf/images/spoticon.jpg\""                            << std::endl;
  *out << "     alt=\"main\""                                        << std::endl;
  *out << "     width=\"64\""                                        << std::endl;
  *out << "     height=\"64\""                                       << std::endl;
  *out << "     border=\"\"/>"                                       << std::endl;
  *out << "    <b>"                                                  << std::endl;
  *out << getApplicationDescriptor()->getClassName() 
       << getApplicationDescriptor()->getInstance()                  << std::endl;
  *out << "    </b>"                                                 << std::endl;
  *out << "  </td>"                                                  << std::endl;
  *out << "  <td width=\"32\">"                                      << std::endl;
  *out << "    <a href=\"/urn:xdaq-application:lid=3\">"             << std::endl;
  *out << "      <img"                                               << std::endl;
  *out << "       align=\"middle\""                                  << std::endl;
  *out << "       src=\"/hyperdaq/images/HyperDAQ.jpg\""             << std::endl;
  *out << "       alt=\"HyperDAQ\""                                  << std::endl;
  *out << "       width=\"32\""                                      << std::endl;
  *out << "       height=\"32\""                                     << std::endl;
  *out << "       border=\"\"/>"                                     << std::endl;
  *out << "    </a>"                                                 << std::endl;
  *out << "  </td>"                                                  << std::endl;
  *out << "  <td width=\"32\">"                                      << std::endl;
  *out << "  </td>"                                                  << std::endl;
  *out << "  <td width=\"32\">"                                      << std::endl;
  *out << "    <a href=\"/" << urn << "/\">"                         << std::endl;
  *out << "      <img"                                               << std::endl;
  *out << "       align=\"middle\""                                  << std::endl;
  *out << "       src=\"/evf/images/idieapp.jpg\""                   << std::endl;
  *out << "       alt=\"main\""                                      << std::endl;
  *out << "       width=\"32\""                                      << std::endl;
  *out << "       height=\"32\""                                     << std::endl;
  *out << "       border=\"\"/>"                                     << std::endl;
  *out << "    </a>"                                                 << std::endl;
  *out << "  </td>"                                                  << std::endl;
  *out << "</tr>"                                                    << std::endl;
  *out << "</table>"                                                 << std::endl;
  *out << "<hr/>"                                                    << std::endl;
  *out << "<table><tr><th>Parameter</th><th>Value</th></tr>"         << std::endl;
  *out << "<tr><td>module legenda messages received</td><td>" 
       << nModuleLegendaMessageReceived_ << "</td></tr>"      << std::endl;
  *out << "<tr><td>path legenda messages received</td><td>" 
       << nPathLegendaMessageReceived_ << "</td></tr>"        << std::endl;
  *out << "<tr><td>module legenda messages with data</td><td>" 
       << nModuleLegendaMessageWithDataReceived_ << "</td></tr>"      << std::endl;
  *out << "<tr><td>path legenda messages with data</td><td>" 
       << nPathLegendaMessageWithDataReceived_ << "</td></tr>"        << std::endl;
  *out << "<tr><td>module histo messages received</td><td>" 
       << nModuleHistoMessageReceived_<< "</td></tr>"        << std::endl;
  *out << "<tr><td>path histo messages received</td><td>" 
       << nPathHistoMessageReceived_<< "</td></tr>"        << std::endl;
  tm *uptm = localtime(&lastPathLegendaMessageTimeStamp_.tv_sec);
  char datestring[256];
  strftime(datestring, sizeof(datestring),"%c", uptm);
  *out << "<tr><td>time stamp of last path legenda with data</td><td>" 
       << datestring << "</td></tr>"        << std::endl;
  uptm = localtime(&lastModuleLegendaMessageTimeStamp_.tv_sec);
  strftime(datestring, sizeof(datestring),"%c", uptm);
  *out << "<tr><td>time stamp of last module legenda with data</td><td>" 
       << datestring << "</td></tr>"        << std::endl;
  *out << "</table></body>" << std::endl;

}
void iDie::summaryTable ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 238 of file iDie.cc.

References dbtoconf::out.

Referenced by iDie().

{
    *out << "<tr><td>"<<fus_.size()<<"</td><td>" << totalCores_ 
         << "</td><td></td></tr>" << std::endl;
}
void iDie::updater ( xgi::Input *  in,
xgi::Output *  out 
) throw (xgi::exception::Exception)

Definition at line 232 of file iDie.cc.

References dbtoconf::out, and sistrip::runNumber_.

Referenced by iDie().

{
  *out << runNumber_.value_ << std::endl;
}
evf::iDie::XDAQ_INSTANTIATOR ( )

Member Data Documentation

TBranch* evf::iDie::b1_ [private]

Definition at line 172 of file iDie.h.

Referenced by parseModuleHisto(), and reset().

TBranch* evf::iDie::b2_ [private]

Definition at line 173 of file iDie.h.

Referenced by parsePathHisto(), and reset().

TBranch* evf::iDie::b3_ [private]

Definition at line 174 of file iDie.h.

Referenced by parsePathHisto(), and reset().

TBranch* evf::iDie::b4_ [private]

Definition at line 175 of file iDie.h.

Referenced by parsePathHisto(), and reset().

TBranch* evf::iDie::b_ [private]

Definition at line 171 of file iDie.h.

Referenced by parseModuleHisto(), and reset().

xdata::String evf::iDie::class_ [private]

Definition at line 152 of file iDie.h.

Referenced by iDie().

xdata::String evf::iDie::configString_ [private]

Definition at line 156 of file iDie.h.

Referenced by iDie().

std::vector<int> evf::iDie::cpuentries_ [private]

Definition at line 161 of file iDie.h.

Referenced by parseModuleHisto(), and reset().

std::vector<std::vector<int> > evf::iDie::cpustat_ [private]

Definition at line 162 of file iDie.h.

Referenced by parseModuleHisto(), and reset().

int* evf::iDie::datap_ [private]

Definition at line 176 of file iDie.h.

Referenced by parseModuleHisto(), and reset().

TFile* evf::iDie::f_ [private]

Definition at line 169 of file iDie.h.

Referenced by parseModuleHisto(), parsePathHisto(), and reset().

fmap evf::iDie::fus_ [private]

Definition at line 157 of file iDie.h.

Referenced by reset().

xdata::String evf::iDie::hostname_ [private]

Definition at line 154 of file iDie.h.

Referenced by iDie().

xdata::UnsignedInteger32 evf::iDie::instance_ [private]

Definition at line 153 of file iDie.h.

Referenced by iDie().

unsigned int evf::iDie::last_ls_ [private]

Definition at line 164 of file iDie.h.

Referenced by reset().

Definition at line 188 of file iDie.h.

Referenced by iDie(), and parseModuleLegenda().

Definition at line 189 of file iDie.h.

Referenced by iDie(), and parsePathLegenda().

Logger evf::iDie::log_ [private]

Definition at line 148 of file iDie.h.

std::vector<std::string> evf::iDie::mapmod_ [private]

Definition at line 163 of file iDie.h.

Referenced by parseModuleHisto(), and parseModuleLegenda().

std::vector<std::string> evf::iDie::mappath_ [private]

Definition at line 167 of file iDie.h.

Referenced by parsePathLegenda().

Definition at line 185 of file iDie.h.

Referenced by parseModuleHisto().

Definition at line 181 of file iDie.h.

Referenced by parseModuleLegenda().

Definition at line 183 of file iDie.h.

Referenced by parseModuleLegenda().

Definition at line 186 of file iDie.h.

Referenced by parsePathHisto().

Definition at line 182 of file iDie.h.

Referenced by parsePathLegenda().

Definition at line 184 of file iDie.h.

Referenced by parsePathLegenda().

unsigned int evf::iDie::nstates_ [private]

Definition at line 160 of file iDie.h.

Referenced by parseModuleHisto(), and parseModuleLegenda().

Definition at line 178 of file iDie.h.

Referenced by parsePathHisto().

xdata::UnsignedInteger32 evf::iDie::runNumber_ [private]

Definition at line 155 of file iDie.h.

Referenced by iDie().

Definition at line 187 of file iDie.h.

Referenced by iDie().

TTree* evf::iDie::t_ [private]

Definition at line 170 of file iDie.h.

Referenced by parseModuleHisto(), parsePathHisto(), and reset().

unsigned int evf::iDie::totalCores_ [private]

Definition at line 159 of file iDie.h.

Referenced by reset().

std::vector<TriggerReportStatic> evf::iDie::trp_ [private]

Definition at line 165 of file iDie.h.

Referenced by parsePathHisto(), and reset().

std::vector<int> evf::iDie::trpentries_ [private]

Definition at line 166 of file iDie.h.

Referenced by parsePathHisto(), and reset().

Definition at line 177 of file iDie.h.

Referenced by parsePathHisto().

xdata::String evf::iDie::url_ [private]

Definition at line 151 of file iDie.h.

Referenced by iDie().