Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:53:36

0001 #ifndef IgTools_IgProf_IgProfService_h
0002 #define IgTools_IgProf_IgProfService_h
0003 
0004 //
0005 //  Description: FWK service to implement hook for igprof memory profile
0006 //               dump functionality
0007 //
0008 //  Peter Elmer, Princeton University                        18 Nov, 2008
0009 //
0010 
0011 #include "DataFormats/Provenance/interface/RunLumiEventNumber.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0014 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0015 
0016 namespace edm {
0017   class GlobalContext;
0018   class StreamContext;
0019 
0020   namespace service {
0021     class IgProfService {
0022     public:
0023       IgProfService(const ParameterSet &, ActivityRegistry &);
0024 
0025       void postBeginJob();
0026 
0027       void postBeginRun(GlobalContext const &gc);
0028 
0029       void postBeginLumi(GlobalContext const &gc);
0030 
0031       void preEvent(StreamContext const &sc);
0032       void postEvent(StreamContext const &sc);
0033 
0034       void preModuleEvent(StreamContext const &sc, ModuleCallingContext const &mcc);
0035       void postModuleEvent(StreamContext const &sc, ModuleCallingContext const &mcc);
0036 
0037       void postEndLumi(GlobalContext const &gc);
0038 
0039       void preEndRun(GlobalContext const &gc);
0040       void postEndRun(GlobalContext const &gc);
0041 
0042       void preEndProcessBlock(GlobalContext const &gc);
0043       void postEndProcessBlock(GlobalContext const &gc);
0044 
0045       void preEndJob();
0046       void postEndJob();
0047 
0048       void postOpenFile(std::string const &);
0049 
0050       void postCloseFile(std::string const &);
0051 
0052       static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0053 
0054     private:
0055       void makeDump(const std::string &format, std::string_view moduleLabel = "");
0056       static std::string replace(const std::string &s, const char *pat, int val);
0057       static std::string replaceU64(const std::string &s, const char *pat, unsigned long long val);
0058       static std::string replace(const std::string &s, const char *pat, std::string_view val);
0059 
0060       void (*dump_)(const char *);
0061 
0062       std::string atPostBeginJob_;
0063       std::string atPostBeginRun_;
0064       std::string atPostBeginLumi_;
0065 
0066       std::string atPreEvent_;
0067       std::string atPostEvent_;
0068 
0069       std::vector<std::string> modules_;
0070       std::vector<std::string> moduleTypes_;
0071       std::string atPreModuleEvent_;
0072       std::string atPostModuleEvent_;
0073 
0074       std::string atPostEndLumi_;
0075       std::string atPreEndRun_;
0076       std::string atPostEndRun_;
0077       std::string atPreEndProcessBlock_;
0078       std::string atPostEndProcessBlock_;
0079       std::string atPreEndJob_;
0080       std::string atPostEndJob_;
0081 
0082       std::string atPostOpenFile_;
0083       std::string atPostCloseFile_;
0084 
0085       int mineventrecord_;
0086       int prescale_;
0087       int nrecord_;  // counter
0088       edm::EventNumber_t nevent_;
0089       edm::RunNumber_t nrun_;
0090       edm::LuminosityBlockNumber_t nlumi_;
0091       int nfileopened_;  // counter of files opened thus far
0092       int nfileclosed_;  // counter of files closed thus far
0093     };
0094     inline bool isProcessWideService(IgProfService const *) { return true; }
0095   }  // namespace service
0096 }  // namespace edm
0097 
0098 #endif