CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

edm::service::Timing Class Reference

#include <Timing.h>

List of all members.

Public Member Functions

 Timing (ParameterSet const &, ActivityRegistry &)
 ~Timing ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

void postBeginJob ()
void postEndJob ()
void postEventProcessing (Event const &, EventSetup const &)
void postModule (ModuleDescription const &)
void preEventProcessing (EventID const &, Timestamp const &)
void preModule (ModuleDescription const &)

Private Attributes

EventID curr_event_
double curr_event_cpu_
double curr_event_time_
double curr_job_cpu_
double curr_job_time_
double curr_module_time_
double max_event_cpu_
double max_event_time_
double min_event_cpu_
double min_event_time_
bool report_summary_
bool summary_only_
int total_event_count_
double total_event_cpu_

Detailed Description

Definition at line 35 of file Timing.h.


Constructor & Destructor Documentation

edm::service::Timing::Timing ( ParameterSet const &  iPS,
ActivityRegistry iRegistry 
)

Definition at line 81 of file Timing.cc.

References postBeginJob(), postEndJob(), postEventProcessing(), postModule(), preEventProcessing(), preModule(), summary_only_, edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().

                                                                       :
        curr_event_(),
        curr_job_time_(0.),
        curr_job_cpu_(0.),
        curr_event_time_(0.),
        curr_event_cpu_(0.),
        curr_module_time_(0.),
        total_event_cpu_(0.),
        summary_only_(iPS.getUntrackedParameter<bool>("summaryOnly")),
        report_summary_(iPS.getUntrackedParameter<bool>("useJobReport")),
        max_event_time_(0.),
        max_event_cpu_(0.),
        min_event_time_(0.),
        min_event_cpu_(0.),
        total_event_count_(0) {
      iRegistry.watchPostBeginJob(this, &Timing::postBeginJob);
      iRegistry.watchPostEndJob(this, &Timing::postEndJob);

      iRegistry.watchPreProcessEvent(this, &Timing::preEventProcessing);
      iRegistry.watchPostProcessEvent(this, &Timing::postEventProcessing);

      if (not summary_only_) {
        iRegistry.watchPreModule(this, &Timing::preModule);
        iRegistry.watchPostModule(this, &Timing::postModule);
      }
    }
edm::service::Timing::~Timing ( )

Definition at line 108 of file Timing.cc.

                    {
    }

Member Function Documentation

void edm::service::Timing::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Definition at line 111 of file Timing.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and edm::ConfigurationDescriptions::setComment().

                                                                         {
      ParameterSetDescription desc;
      desc.addUntracked<bool>("summaryOnly", false)->setComment(
      "If 'true' do not report timing for each event");
      desc.addUntracked<bool>("useJobReport", true)->setComment(
       "If 'true' write summary information to JobReport");
      descriptions.add("Timing", desc);
      descriptions.setComment(
       "This service reports the time it takes to run each module in a job.");
    }
void edm::service::Timing::postBeginJob ( ) [private]

Definition at line 122 of file Timing.cc.

References curr_job_cpu_, curr_job_time_, edm::service::getCPU(), edm::service::getTime(), summary_only_, and total_event_cpu_.

Referenced by Timing().

                              {
      curr_job_time_ = getTime();
      curr_job_cpu_ = getCPU();
      total_event_cpu_ = 0.0;

      //LogInfo("TimeReport")
      if (not summary_only_) {
        LogImportant("TimeReport")                              // ChangeLog 3
        << "TimeReport> Report activated" << "\n"
        << "TimeReport> Report columns headings for events: "
        << "eventnum runnum timetaken\n"
        << "TimeReport> Report columns headings for modules: "
        << "eventnum runnum modulelabel modulename timetakeni\n"
        << "TimeReport> JobTime=" << curr_job_time_  << " JobCPU=" << curr_job_cpu_  << "\n";
      }
    }
void edm::service::Timing::postEndJob ( ) [private]

Definition at line 139 of file Timing.cc.

References curr_job_cpu_, curr_job_time_, edm::service::d2str(), edm::service::getCPU(), edm::service::getTime(), max_event_cpu_, max_event_time_, min_event_cpu_, min_event_time_, report_summary_, total_event_count_, and total_event_cpu_.

Referenced by Timing().

                            {
      double total_job_time = getTime() - curr_job_time_;
      double average_event_time = total_job_time / total_event_count_;

      double total_job_cpu = getCPU() - curr_job_cpu_;
      double average_event_cpu = total_event_cpu_ / total_event_count_;

      //LogAbsolute("FwkJob")
      //LogAbsolute("TimeReport")                               // Changelog 1
      LogImportant("TimeReport")                                // Changelog 3
        << "TimeReport> Time report complete in "
        << total_job_time << " seconds"
        << "\n"
        << " Time Summary: \n"
        << " - Min event:   " << min_event_time_ << "\n"
        << " - Max event:   " << max_event_time_ << "\n"
        << " - Avg event:   " << average_event_time << "\n"
        << " - Total job:   " << total_job_time << "\n"
        << " CPU Summary: \n"
        << " - Min event:   " << min_event_cpu_ << "\n"
        << " - Max event:   " << max_event_cpu_ << "\n"
        << " - Avg event:   " << average_event_cpu << "\n"
        << " - Total job:   " << total_job_cpu << "\n"
        << " - Total event: " << total_event_cpu_ << "\n";

      if (report_summary_) {
        Service<JobReport> reportSvc;
//      std::map<std::string, double> reportData;
        std::map<std::string, std::string> reportData;

        reportData.insert(std::make_pair("MinEventTime", d2str(min_event_time_)));
        reportData.insert(std::make_pair("MaxEventTime", d2str(max_event_time_)));
        reportData.insert(std::make_pair("AvgEventTime", d2str(average_event_time)));
        reportData.insert(std::make_pair("TotalJobTime", d2str(total_job_time)));
        reportData.insert(std::make_pair("MinEventCPU", d2str(min_event_cpu_)));
        reportData.insert(std::make_pair("MaxEventCPU", d2str(max_event_cpu_)));
        reportData.insert(std::make_pair("AvgEventCPU", d2str(average_event_cpu)));
        reportData.insert(std::make_pair("TotalJobCPU", d2str(total_job_cpu)));
        reportData.insert(std::make_pair("TotalEventCPU", d2str(total_event_cpu_)));
        
        reportSvc->reportPerformanceSummary("Timing", reportData);
//      reportSvc->reportTimingInfo(reportData);
      }
    }
void edm::service::Timing::postEventProcessing ( Event const &  e,
EventSetup const &   
) [private]
void edm::service::Timing::postModule ( ModuleDescription const &  desc) [private]

Definition at line 223 of file Timing.cc.

References curr_event_, curr_module_time_, edm::EventID::event(), edm::service::getTime(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), edm::EventID::run(), summary_only_, and matplotRender::t.

Referenced by Timing().

                                                         {
      double t = getTime() - curr_module_time_;
      //LogInfo("TimeModule")
      if (not summary_only_) {
        LogPrint("TimeModule") << "TimeModule> "                // ChangeLog 4
           << curr_event_.event() << " "
           << curr_event_.run() << " "
           << desc.moduleLabel() << " "
           << desc.moduleName() << " "
           << t;
      }

    }
void edm::service::Timing::preEventProcessing ( EventID const &  iID,
Timestamp const &  iTime 
) [private]
void edm::service::Timing::preModule ( ModuleDescription const &  ) [private]

Definition at line 219 of file Timing.cc.

References curr_module_time_, and edm::service::getTime().

Referenced by Timing().


Member Data Documentation

Definition at line 52 of file Timing.h.

Referenced by postEventProcessing(), postModule(), and preEventProcessing().

Definition at line 56 of file Timing.h.

Referenced by postEventProcessing(), and preEventProcessing().

Definition at line 55 of file Timing.h.

Referenced by postEventProcessing(), and preEventProcessing().

Definition at line 54 of file Timing.h.

Referenced by postBeginJob(), and postEndJob().

Definition at line 53 of file Timing.h.

Referenced by postBeginJob(), and postEndJob().

Definition at line 57 of file Timing.h.

Referenced by postModule(), and preModule().

Definition at line 66 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

Definition at line 65 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

Definition at line 68 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

Definition at line 67 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

Definition at line 60 of file Timing.h.

Referenced by postEndJob().

Definition at line 59 of file Timing.h.

Referenced by postBeginJob(), postEventProcessing(), postModule(), and Timing().

Definition at line 69 of file Timing.h.

Referenced by postEndJob(), and postEventProcessing().

Definition at line 58 of file Timing.h.

Referenced by postBeginJob(), postEndJob(), and postEventProcessing().