#include <ExceptionGenerator.h>
Public Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
void | beginJob () |
void | beginRun (edm::Run &r) |
void | defaultWebPage (xgi::Input *in, xgi::Output *out) |
void | endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) |
ExceptionGenerator (const edm::ParameterSet &) | |
void | publish (xdata::InfoSpace *) |
~ExceptionGenerator () | |
Static Public Attributes | |
static const std::string | menu [menu_items] |
static const int | menu_items = 10 |
Private Attributes | |
int | actionId_ |
bool | actionRequired_ |
unsigned int | intqualifier_ |
std::string | original_referrer_ |
std::string | qualifier_ |
Definition at line 20 of file ExceptionGenerator.h.
evf::ExceptionGenerator::ExceptionGenerator | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 30 of file ExceptionGenerator.cc.
: ModuleWeb("ExceptionGenerator"), actionId_(pset.getUntrackedParameter<int>("defaultAction",-1)), intqualifier_(pset.getUntrackedParameter<int>("defaultQualifier",0)), actionRequired_(actionId_!=-1) { }
evf::ExceptionGenerator::~ExceptionGenerator | ( | ) | [inline] |
Definition at line 27 of file ExceptionGenerator.h.
{};
void evf::ExceptionGenerator::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 44 of file ExceptionGenerator.cc.
References actionId_, actionRequired_, Exception, cmsRelvalreport::exit, intqualifier_, j, funct::log(), pi, qualifier_, stor::utils::sleep(), mathSSE::sqrt(), and ExpressReco_HICollisions_FallBack::step.
{ float dummy = 0.; if(actionRequired_) { int *pi = 0; int ind = 0; int step = 1; switch(actionId_) { case 0: ::usleep(intqualifier_*1000); break; case 1: ::sleep(0xFFFFFFF); break; case 2: throw cms::Exception(qualifier_) << "This exception was generated by the ExceptionGenerator"; break; case 3: exit(-1); break; case 4: abort(); break; case 5: throw qualifier_; break; case 6: while(1){ind+=step; if(ind>1000000) step = -1; if(ind==0) step = 1;} break; case 7: edm::LogError("TestErrorMessage") << qualifier_; break; case 8: *pi=0; break; case 9: for(unsigned int j=0; j<intqualifier_*1000;j++){ dummy += sqrt(log(float(j+1)))/float(j*j); } break; } } }
void evf::ExceptionGenerator::beginJob | ( | void | ) | [virtual] |
void evf::ExceptionGenerator::beginRun | ( | edm::Run & | r | ) |
Definition at line 41 of file ExceptionGenerator.cc.
{ }
void evf::ExceptionGenerator::defaultWebPage | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | [virtual] |
Reimplemented from evf::ModuleWeb.
Definition at line 96 of file ExceptionGenerator.cc.
References actionId_, actionRequired_, gather_cfg::cout, ExpressReco_HICollisions_FallBack::e, exception, first, i, collect_tpl::input, intqualifier_, menu, menu_items, evf::ModuleWeb::moduleName_, original_referrer_, path(), pos, qualifier_, o2o::query, edm::second(), benchmark_cfg::select, and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.
{ std::string path; std::string urn; std::string mname; std::string query; try { cgicc::Cgicc cgi(in); if ( xgi::Utils::hasFormElement(cgi,"exceptiontype") ) { actionId_ = xgi::Utils::getFormElement(cgi, "exceptiontype")->getIntegerValue(); qualifier_ = xgi::Utils::getFormElement(cgi, "qualifier")->getValue(); intqualifier_ = xgi::Utils::getFormElement(cgi, "qualifier")->getIntegerValue(); actionRequired_ = true; } if ( xgi::Utils::hasFormElement(cgi,"module") ) mname = xgi::Utils::getFormElement(cgi, "module")->getValue(); cgicc::CgiEnvironment cgie(in); if(original_referrer_ == "") original_referrer_ = cgie.getReferrer(); path = cgie.getPathInfo(); query = cgie.getQueryString(); if(actionId_>=0) std::cout << " requested action " << actionId_ << " " << menu[actionId_] << ". Number of cycles " << intqualifier_ << std::endl; } catch (const std::exception & e) { // don't care if it did not work } using std::endl; *out << "<html>" << endl; *out << "<head>" << endl; *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> " << endl; *out << "<link type=\"text/css\" rel=\"stylesheet\""; *out << " href=\"/" << urn << "/styles.css\"/>" << endl; *out << "<title>" << moduleName_ << " MAIN</title>" << endl; *out << "</head>" << endl; *out << "<body onload=\"loadXMLDoc()\">" << endl; *out << "<table border=\"0\" width=\"100%\">" << endl; *out << "<tr>" << endl; *out << " <td align=\"left\">" << endl; *out << " <img" << endl; *out << " align=\"middle\"" << endl; *out << " src=\"/evf/images/systemerror.jpg\"" << endl; *out << " alt=\"main\"" << endl; *out << " width=\"90\"" << endl; *out << " height=\"64\"" << endl; *out << " border=\"\"/>" << endl; *out << " <b>" << endl; *out << moduleName_ << endl; *out << " </b>" << endl; *out << " </td>" << endl; *out << " <td width=\"32\">" << endl; *out << " <a href=\"/urn:xdaq-application:lid=3\">" << endl; *out << " <img" << endl; *out << " align=\"middle\"" << endl; *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << endl; *out << " alt=\"HyperDAQ\"" << endl; *out << " width=\"32\"" << endl; *out << " height=\"32\"" << endl; *out << " border=\"\"/>" << endl; *out << " </a>" << endl; *out << " </td>" << endl; *out << " <td width=\"32\">" << endl; *out << " </td>" << endl; *out << " <td width=\"32\">" << endl; *out << " <a href=\"" << original_referrer_ << "\">" << endl; *out << " <img" << endl; *out << " align=\"middle\"" << endl; *out << " src=\"/evf/images/spoticon.jpg\"" << endl; *out << " alt=\"main\"" << endl; *out << " width=\"32\"" << endl; *out << " height=\"32\"" << endl; *out << " border=\"\"/>" << endl; *out << " </a>" << endl; *out << " </td>" << endl; *out << "</tr>" << endl; *out << "</table>" << endl; *out << "<hr/>" << endl; *out << cgicc::form().set("method","GET").set("action", path ) << std::endl; boost::char_separator<char> sep("&"); boost::tokenizer<boost::char_separator<char> > tokens(query, sep); for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter){ size_t pos = (*tok_iter).find_first_of("="); if(pos != std::string::npos){ std::string first = (*tok_iter).substr(0 , pos); std::string second = (*tok_iter).substr(pos+1, (*tok_iter).length()-pos-1); *out << cgicc::input().set("type","hidden").set("name",first).set("value", second) << std::endl; } } *out << "Select " << endl; *out << cgicc::select().set("name","exceptiontype") << std::endl; char istring[2]; for(int i = 0; i < menu_items; i++) { sprintf(istring,"%d",i); *out << cgicc::option().set("value",istring) << menu[i] << cgicc::option() << std::endl; } *out << cgicc::select() << std::endl; *out << "<br>" << endl; *out << "Qualifier" << endl; *out << cgicc::input().set("type","text").set("name","qualifier") << std::endl; *out << cgicc::input().set("type","submit").set("value","Do It !") << std::endl; *out << cgicc::form() << std::endl; *out << "</body>" << endl; *out << "</html>" << endl; }
void evf::ExceptionGenerator::endLuminosityBlock | ( | edm::LuminosityBlock const & | lb, |
edm::EventSetup const & | es | ||
) | [virtual] |
void evf::ExceptionGenerator::publish | ( | xdata::InfoSpace * | is | ) | [virtual] |
int evf::ExceptionGenerator::actionId_ [private] |
Definition at line 37 of file ExceptionGenerator.h.
Referenced by analyze(), and defaultWebPage().
bool evf::ExceptionGenerator::actionRequired_ [private] |
Definition at line 40 of file ExceptionGenerator.h.
Referenced by analyze(), and defaultWebPage().
unsigned int evf::ExceptionGenerator::intqualifier_ [private] |
Definition at line 38 of file ExceptionGenerator.h.
Referenced by analyze(), and defaultWebPage().
const std::string evf::ExceptionGenerator::menu [static] |
{"Sleep x ms", "SleepForever", "Cms Exception", "Exit with error", "Abort", "Unknown Exception", "Endless loop", "Generate Error Message", "Segfault", "Burn CPU"}
Definition at line 24 of file ExceptionGenerator.h.
Referenced by defaultWebPage().
const int evf::ExceptionGenerator::menu_items = 10 [static] |
Definition at line 23 of file ExceptionGenerator.h.
Referenced by defaultWebPage().
std::string evf::ExceptionGenerator::original_referrer_ [private] |
Definition at line 41 of file ExceptionGenerator.h.
Referenced by defaultWebPage().
std::string evf::ExceptionGenerator::qualifier_ [private] |
Definition at line 39 of file ExceptionGenerator.h.
Referenced by analyze(), and defaultWebPage().