CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/EventFilter/Goodies/src/iDie.h

Go to the documentation of this file.
00001 #ifndef EVENTFILTER_GOODIES_IDIE_H
00002 #define EVENTFILTER_GOODIES_IDIE_H
00003 
00004 #include "EventFilter/Utilities/interface/Exception.h"
00005 #include "EventFilter/Utilities/interface/TriggerReportDef.h"
00006 
00007 #include "xdata/String.h"
00008 #include "xdata/UnsignedInteger32.h"
00009 #include "xdata/ActionListener.h"
00010 
00011 #include "xoap/MessageReference.h"
00012 #include "xoap/MessageFactory.h"
00013 #include "xoap/Method.h"
00014 
00015 #include "xgi/Utils.h"
00016 #include "xgi/Input.h"
00017 #include "xgi/Output.h"
00018 #include "xgi/Method.h"
00019 
00020 #include "xdaq/Application.h"
00021 
00022 #include "toolbox/net/URN.h"
00023 #include "toolbox/fsm/exception/Exception.h"
00024 
00025 
00026 #include <vector>
00027 
00028 #include <sys/time.h>
00029 
00030 
00031 namespace evf {
00032 
00033 
00034   namespace internal{
00035    struct fu{
00036       time_t tstamp;
00037       unsigned int ccount;
00038       std::vector<pid_t> cpids;
00039       std::vector<std::string> signals;
00040       std::vector<std::string> stacktraces;
00041     };
00042   }
00043   typedef std::map<std::string,internal::fu> fmap;
00044   typedef fmap::iterator ifmap;
00045   
00046   class iDie : public xdaq::Application,
00047     public xdata::ActionListener
00048   {
00049   public:
00050     //
00051     // xdaq instantiator macro
00052     //
00053     XDAQ_INSTANTIATOR();
00054   
00055     
00056     //
00057     // construction/destruction
00058     //
00059     iDie(xdaq::ApplicationStub *s);
00060     virtual ~iDie();
00061     //UI
00062     void defaultWeb(xgi::Input *in,xgi::Output *out)
00063       throw (xgi::exception::Exception);
00064     void summaryTable(xgi::Input *in,xgi::Output *out)
00065       throw (xgi::exception::Exception);
00066     void detailsTable(xgi::Input *in,xgi::Output *out)
00067       throw (xgi::exception::Exception);
00068     void dumpTable(xgi::Input *in,xgi::Output *out)
00069       throw (xgi::exception::Exception);
00070     void updater(xgi::Input *in,xgi::Output *out)
00071       throw (xgi::exception::Exception);
00072     void iChoke(xgi::Input *in,xgi::Output *out)
00073       throw (xgi::exception::Exception);
00074     void iChokeMiniInterface(xgi::Input *in,xgi::Output *out)
00075       throw (xgi::exception::Exception);
00076     //AI
00077     void postEntry(xgi::Input*in,xgi::Output*out)
00078       throw (xgi::exception::Exception);
00079     void postEntryiChoke(xgi::Input*in,xgi::Output*out)
00080       throw (xgi::exception::Exception);
00081     
00082     // *fake* fsm soap command callback
00083     xoap::MessageReference fsmCallback(xoap::MessageReference msg)
00084       throw (xoap::exception::Exception);
00085 
00086     // xdata:ActionListener interface
00087     void actionPerformed(xdata::Event& e);
00088 
00089 
00090   private:
00091 
00092     struct sorted_indices{
00093       sorted_indices(const std::vector<int> &arr) : arr_(arr)
00094       {
00095         ind_.resize(arr_.size(),0);
00096         unsigned int i = 0;
00097         while(i<ind_.size()) {ind_[i] = i; i++;}
00098         std::sort(ind_.rbegin(),ind_.rend(),*this);
00099       }
00100       int operator[](size_t ind) const {return arr_[ind_[ind]];}
00101       
00102       bool operator()(const size_t a, const size_t b) const
00103       {
00104         return arr_[a]<arr_[b];
00105       }
00106       int ii(size_t ind){return ind_[ind];}
00107       std::vector<int> ind_;
00108       const std::vector<int> &arr_;
00109     };
00110     //
00111     // private member functions
00112     //
00113     
00114     void reset();
00115     void parseModuleLegenda(std::string);
00116     void parseModuleHisto(const char *, unsigned int);
00117     void parsePathLegenda(std::string);
00118     void parsePathHisto(const unsigned char *, unsigned int);
00119     //
00120     // member data
00121     //
00122 
00123     // message logger
00124     Logger                          log_;
00125                 
00126     // monitored parameters
00127     xdata::String                   url_;
00128     xdata::String                   class_;
00129     xdata::UnsignedInteger32        instance_;
00130     xdata::String                   hostname_;
00131     xdata::UnsignedInteger32        runNumber_;
00132     xdata::String                   configString_;
00133     fmap                            fus_;
00134     
00135     unsigned int                    totalCores_;
00136     unsigned int                    nstates_;   
00137     std::vector<int>                cpuentries_;
00138     std::vector<std::vector<int> >  cpustat_;
00139     std::vector<std::string>        mapmod_;
00140     unsigned int                    last_ls_;
00141     std::vector<TriggerReportStatic>trp_;
00142     std::vector<int>                trpentries_;
00143     std::vector<std::string>        mappath_;
00144   }; // class iDie
00145 
00146 
00147 } // namespace evf
00148 
00149 
00150 #endif