00001 #ifndef Services_TIMING_h 00002 #define Services_TIMING_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Services 00006 // Class : Timing 00007 // 00008 // 00009 // Original Author: Jim Kowalkowski 00010 // 00011 00012 /* 00013 00014 Changes Log 1: 2009/01/14 10:29:00, Natalia Garcia Nebot 00015 Modified the service to add some new measurements: 00016 - Average time per event (cpu and wallclock) 00017 - Fastest time per event (cpu and wallclock) 00018 - Slowest time per event (cpu and wallclock) 00019 */ 00020 00021 00022 #include "sigc++/signal.h" 00023 00024 #include "DataFormats/Provenance/interface/EventID.h" 00025 #include "DataFormats/Provenance/interface/ProvenanceFwd.h" 00026 00027 namespace edm { 00028 class ActivityRegistry; 00029 class Event; 00030 class EventSetup; 00031 class ParameterSet; 00032 class ConfigurationDescriptions; 00033 00034 namespace service { 00035 class Timing { 00036 public: 00037 Timing(ParameterSet const&,ActivityRegistry&); 00038 ~Timing(); 00039 00040 static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); 00041 00042 sigc::signal<void, ModuleDescription const&, double> newMeasurementSignal; 00043 private: 00044 void postBeginJob(); 00045 void postEndJob(); 00046 00047 void preEventProcessing(EventID const&, Timestamp const&); 00048 void postEventProcessing(Event const&, EventSetup const&); 00049 00050 void preModule(ModuleDescription const&); 00051 void postModule(ModuleDescription const&); 00052 00053 EventID curr_event_; 00054 double curr_job_time_; // seconds 00055 double curr_job_cpu_; // seconds 00056 double curr_event_time_; // seconds 00057 double curr_event_cpu_; // seconds 00058 double curr_module_time_; // seconds 00059 double total_event_cpu_; // seconds 00060 bool summary_only_; 00061 bool report_summary_; 00062 00063 // 00064 // Min Max and average event times for summary 00065 // at end of job 00066 double max_event_time_; // seconds 00067 double max_event_cpu_; // seconds 00068 double min_event_time_; // seconds 00069 double min_event_cpu_; // seconds 00070 int total_event_count_; 00071 }; 00072 } 00073 } 00074 00075 #endif