ATLAS Offline Software
Loading...
Searching...
No Matches
StopwatchModule.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9//
10// includes
11//
12
14
17#include <TList.h>
18#include <TStopwatch.h>
19
20//
21// method implementations
22//
23
24namespace EL
25{
26 namespace Detail
27 {
28 ::StatusCode StopwatchModule ::
29 firstInitialize (ModuleData& /*data*/)
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 }
45
46
47
48 ::StatusCode StopwatchModule ::
49 onFileExecute (ModuleData& /*data*/)
50 {
51 m_runTime->Fill (1);
52 return ::StatusCode::SUCCESS;
53 }
54
55
56
57 ::StatusCode StopwatchModule ::
58 postFinalize (ModuleData& data)
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 }
68
69
70
71 ::StatusCode StopwatchModule ::
72 onWorkerEnd (ModuleData& /*data*/)
73 {
74 m_stopwatch->Stop ();
75 m_stopwatch->Print ();
76 return ::StatusCode::SUCCESS;
77 }
78 }
79}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::unique_ptr< TStopwatch > m_stopwatch
the stop watch we use for measuring total time spend
std::unique_ptr< TH1 > m_runTime
the run time summary histogram
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
the data the EventLoop core classes are sharing with the Module implementation
Definition ModuleData.h:64