ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
EL::Detail::StopwatchModule Class Referencefinal

a Module wrapping the TStopwatch class More...

#include <StopwatchModule.h>

Inheritance diagram for EL::Detail::StopwatchModule:
Collaboration diagram for EL::Detail::StopwatchModule:

Public Member Functions

virtual StatusCode firstInitialize (ModuleData &data) override
 action at the the very beginning of the worker job More...
 
virtual StatusCode onFileExecute (ModuleData &data) override
 actions just before fileExecute is called on algorithms More...
 
virtual StatusCode postFinalize (ModuleData &data) override
 actions after algorithms have been finalized More...
 
virtual StatusCode onWorkerEnd (ModuleData &data) override
 action at the end of the worker job More...
 
virtual StatusCode preFileInitialize (ModuleData &data)
 action before opening the first file in the worker job More...
 
virtual StatusCode onInitialize (ModuleData &data)
 action just before algorithms are initialized More...
 
virtual StatusCode processInputs (ModuleData &data, IInputModuleActions &actions)
 process all input files More...
 
virtual StatusCode postFirstEvent (ModuleData &data)
 action after processing first event More...
 
virtual StatusCode onNewInputFile (ModuleData &data)
 actions after opening a new input file More...
 
virtual StatusCode onCloseInputFile (ModuleData &data)
 actions before closing an input file More...
 
virtual StatusCode postCloseInputFile (ModuleData &data)
 actions after CloseInputFile is called on the algorithms More...
 
virtual StatusCode onExecute (ModuleData &data)
 actions just before execute is called on algorithms More...
 
virtual StatusCode onFinalize (ModuleData &data)
 actions just before algorithms are finalized More...
 
virtual StatusCode postFileClose (ModuleData &data)
 action at end of the worker job More...
 
virtual void reportInputFailure (ModuleData &data)
 report that we failed to open our input file More...
 

Private Attributes

std::unique_ptr< TH1m_runTime {nullptr}
 the run time summary histogram More...
 
std::unique_ptr< TStopwatch > m_stopwatch
 the stop watch we use for measuring total time spend More...
 

Detailed Description

a Module wrapping the TStopwatch class

Definition at line 24 of file StopwatchModule.h.

Member Function Documentation

◆ firstInitialize()

StatusCode EL::Detail::StopwatchModule::firstInitialize ( ModuleData data)
overridevirtual

action at the the very beginning of the worker job

This gets called as early as possible in the worker initialization. Essentially all that should happen before this is to load all the modules. The main purpose is to start any benchmarks that are meant to capture the initialization process as well.

Reimplemented from EL::Detail::Module.

Definition at line 28 of file StopwatchModule.cxx.

30  {
31  m_stopwatch = std::make_unique<TStopwatch> ();
32 
33  m_stopwatch->Start ();
34 
35  m_runTime = std::make_unique<TH1D> ("EventLoop_RunTime", "worker run-time summary", 5, 0, 5);
36  m_runTime->SetDirectory (nullptr);
37  m_runTime->Fill (0);
38  m_runTime->GetXaxis()->SetBinLabel (1, "jobs");
39  m_runTime->GetXaxis()->SetBinLabel (2, "files");
40  m_runTime->GetXaxis()->SetBinLabel (3, "events");
41  m_runTime->GetXaxis()->SetBinLabel (4, "cpu time");
42  m_runTime->GetXaxis()->SetBinLabel (5, "real time");
43  return ::StatusCode::SUCCESS;
44  }

◆ onCloseInputFile()

StatusCode EL::Detail::Module::onCloseInputFile ( ModuleData data)
virtualinherited

actions before closing an input file

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::TreeCacheModule.

Definition at line 43 of file Module.cxx.

45  {
46  return ::StatusCode::SUCCESS;
47  }

◆ onExecute()

StatusCode EL::Detail::Module::onExecute ( ModuleData data)
virtualinherited

actions just before execute is called on algorithms

For now that is mostly used to point input modules to the right event

Reimplemented in EL::Detail::TEventModule, EL::Detail::AlgorithmStateModule, EL::Detail::MemoryMonitorModule, and EL::Detail::GridReportingModule.

Definition at line 71 of file Module.cxx.

73  {
74  return ::StatusCode::SUCCESS;
75  }

◆ onFileExecute()

StatusCode EL::Detail::StopwatchModule::onFileExecute ( ModuleData data)
overridevirtual

actions just before fileExecute is called on algorithms

Reimplemented from EL::Detail::Module.

Definition at line 48 of file StopwatchModule.cxx.

50  {
51  m_runTime->Fill (1);
52  return ::StatusCode::SUCCESS;
53  }

◆ onFinalize()

StatusCode EL::Detail::Module::onFinalize ( ModuleData data)
virtualinherited

actions just before algorithms are finalized

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::MemoryMonitorModule.

Definition at line 89 of file Module.cxx.

91  {
92  return ::StatusCode::SUCCESS;
93  }

◆ onInitialize()

StatusCode EL::Detail::Module::onInitialize ( ModuleData data)
virtualinherited

action just before algorithms are initialized

This is typically used for any setup that this module needs to do.

Reimplemented in EL::Detail::TEventModule, EL::Detail::AlgorithmStateModule, EL::Detail::MemoryMonitorModule, EL::Detail::FileExecutedModule, EL::Detail::FactoryPreloadModule, and EL::Detail::WorkerConfigModule.

Definition at line 77 of file Module.cxx.

79  {
80  return ::StatusCode::SUCCESS;
81  }

◆ onNewInputFile()

StatusCode EL::Detail::Module::onNewInputFile ( ModuleData data)
virtualinherited

actions after opening a new input file

Reimplemented in EL::Detail::TEventModule, EL::Detail::AlgorithmStateModule, EL::Detail::GridReportingModule, and EL::Detail::TreeCacheModule.

Definition at line 37 of file Module.cxx.

39  {
40  return ::StatusCode::SUCCESS;
41  }

◆ onWorkerEnd()

StatusCode EL::Detail::StopwatchModule::onWorkerEnd ( ModuleData data)
overridevirtual

action at the end of the worker job

This is mostly meant/used to print job summary statements at the very end of worker job, and actually have them show up at or at least near the end of any log file.

Reimplemented from EL::Detail::Module.

Definition at line 71 of file StopwatchModule.cxx.

73  {
74  m_stopwatch->Stop ();
75  m_stopwatch->Print ();
76  return ::StatusCode::SUCCESS;
77  }

◆ postCloseInputFile()

StatusCode EL::Detail::Module::postCloseInputFile ( ModuleData data)
virtualinherited

actions after CloseInputFile is called on the algorithms

Right now that is only used to disconnect the TEvent object from the input file.

Reimplemented in EL::Detail::TEventModule.

Definition at line 49 of file Module.cxx.

51  {
52  return ::StatusCode::SUCCESS;
53  }

◆ postFileClose()

StatusCode EL::Detail::Module::postFileClose ( ModuleData data)
virtualinherited

action at end of the worker job

Executed just right before worker exit successfully at this stage all outputs have been created

Reimplemented in EL::Detail::GridReportingModule, and EL::Detail::PostClosedOutputsModule.

Definition at line 107 of file Module.cxx.

109  {
110  return ::StatusCode::SUCCESS;
111  }

◆ postFinalize()

StatusCode EL::Detail::StopwatchModule::postFinalize ( ModuleData data)
overridevirtual

actions after algorithms have been finalized

This is usually used to calculate some job summary information that is to be stored it in the histogram output file.

Reimplemented from EL::Detail::Module.

Definition at line 57 of file StopwatchModule.cxx.

59  {
60  m_stopwatch->Stop ();
61  m_runTime->Fill (2, data.m_eventsProcessed);
62  m_runTime->Fill (3, m_stopwatch->CpuTime());
63  m_runTime->Fill (4, m_stopwatch->RealTime());
64  m_stopwatch->Continue ();
65  data.addOutput (std::move (m_runTime));
66  return ::StatusCode::SUCCESS;
67  }

◆ postFirstEvent()

StatusCode EL::Detail::Module::postFirstEvent ( ModuleData data)
virtualinherited

action after processing first event

This is mostly meant to set up benchmarks that record per-event performance. While a lot of initialization happens during initialize() there is a fair amount of initialization that happens on the first event, so when recording per-event performance the first event is sort of "special" and may need to be omitted.

Reimplemented in EL::Detail::MemoryMonitorModule, and EL::Detail::LeakCheckModule.

Definition at line 55 of file Module.cxx.

57  {
58  return ::StatusCode::SUCCESS;
59  }

◆ preFileInitialize()

StatusCode EL::Detail::Module::preFileInitialize ( ModuleData data)
virtualinherited

action before opening the first file in the worker job

This is mostly meant to allow loading the dictionaries before any files and associated information is loaded.

Definition at line 31 of file Module.cxx.

33  {
34  return ::StatusCode::SUCCESS;
35  }

◆ processInputs()

StatusCode EL::Detail::Module::processInputs ( ModuleData data,
IInputModuleActions actions 
)
virtualinherited

process all input files

This deviates slightly from the usual pattern for module functions in that I pass in the possible actions as an argument. See IInputModuleActions for details.

Reimplemented in EL::Detail::BatchInputModule, and EL::Detail::DirectInputModule.

Definition at line 83 of file Module.cxx.

85  {
86  return ::StatusCode::SUCCESS;
87  }

◆ reportInputFailure()

void EL::Detail::Module::reportInputFailure ( ModuleData data)
virtualinherited

report that we failed to open our input file

Reimplemented in EL::Detail::GridReportingModule.

Definition at line 61 of file Module.cxx.

63  {}

Member Data Documentation

◆ m_runTime

std::unique_ptr<TH1> EL::Detail::StopwatchModule::m_runTime {nullptr}
private

the run time summary histogram

Definition at line 45 of file StopwatchModule.h.

◆ m_stopwatch

std::unique_ptr<TStopwatch> EL::Detail::StopwatchModule::m_stopwatch
private

the stop watch we use for measuring total time spend

Definition at line 49 of file StopwatchModule.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
EL::Detail::StopwatchModule::m_stopwatch
std::unique_ptr< TStopwatch > m_stopwatch
the stop watch we use for measuring total time spend
Definition: StopwatchModule.h:49
EL::Detail::StopwatchModule::m_runTime
std::unique_ptr< TH1 > m_runTime
the run time summary histogram
Definition: StopwatchModule.h:45