00001 #ifndef IgTools_IgProf_IgProfService_h 00002 #define IgTools_IgProf_IgProfService_h 00003 00004 // 00005 // Description: FWK service to implement hook for igprof memory profile 00006 // dump functionality 00007 // 00008 // Peter Elmer, Princeton University 18 Nov, 2008 00009 // 00010 00011 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00012 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" 00013 00014 namespace edm { 00015 namespace service { 00016 class IgProfService { 00017 00018 public: 00019 00020 IgProfService(const ParameterSet&,ActivityRegistry&); 00021 00022 void postBeginJob(); 00023 00024 void postBeginRun(Run const& run, EventSetup const& es); 00025 00026 void postBeginLumi(LuminosityBlock const& run, EventSetup const& es); 00027 00028 void preEvent(EventID const& id, Timestamp const& ts); 00029 void postEvent(Event const& ev, EventSetup const& es); 00030 00031 void postEndLumi(LuminosityBlock const& run, EventSetup const& es); 00032 00033 void postEndRun(Run const& run, EventSetup const& es); 00034 00035 void postEndJob(); 00036 00037 void postOpenFile(); 00038 00039 void postCloseFile(); 00040 00041 inline 00042 bool isProcessWideService(IgProfService const*) { 00043 return true; 00044 } 00045 00046 private: 00047 00048 void makeDump(const std::string &format); 00049 static std::string replace(const std::string &s, 00050 const char *pat, int val); 00051 00052 void (*dump_)(const char *); 00053 00054 std::string atPostBeginJob_; 00055 std::string atPostBeginRun_; 00056 std::string atPostBeginLumi_; 00057 00058 std::string atPreEvent_; 00059 std::string atPostEvent_; 00060 00061 std::string atPostEndLumi_; 00062 std::string atPostEndRun_; 00063 std::string atPostEndJob_; 00064 00065 std::string atPostOpenFile_; 00066 std::string atPostCloseFile_; 00067 00068 int mineventrecord_; 00069 int prescale_; 00070 int nrecord_; // counter 00071 int nevent_; 00072 int nrun_; 00073 int nlumi_; 00074 int nfileopened_; // counter of files opened thus far 00075 int nfileclosed_; // counter of files closed thus far 00076 00077 }; 00078 } 00079 } 00080 00081 00082 #endif