ATLAS Offline Software
PyChrono.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // PyStore.cxx
8 // Implementation file for class Py::Store
9 // Author: S.Binet<binet@cern.ch>
11 
12 // PerfMonEvent includes
13 #include "PerfMonEvent/PyChrono.h"
14 
15 // Framework includes
16 #include "GaudiKernel/ServiceHandle.h"
17 #include "GaudiKernel/IChronoStatSvc.h"
18 #include "GaudiKernel/ChronoEntity.h"
19 #include "GaudiKernel/StatEntity.h"
20 
21 // STL includes
22 #include <stdexcept>
23 
24 using namespace PerfMon;
25 
27 // Public methods:
29 
30 // Constructors
32 
34  m_chronoSvc( "ChronoStatSvc", "PerfMon::PyChrono" )
35 {
36  if ( ! m_chronoSvc.retrieve().isSuccess() ) {
37  throw std::exception();
38  }
39 }
40 
41 // Destructor
44 {}
45 
46 
48 // Non-const methods:
50 
51 void PyChrono::chronoStart( const std::string& t )
52 { m_chronoSvc->chronoStart(t); }
53 
54 void PyChrono::chronoStop( const std::string& t )
55 { m_chronoSvc->chronoStop(t); }
56 
57 double
58 PyChrono::chronoDelta( const std::string& t ,
59  const std::string& f )
60 {
61  double v = -999.;
62  if ( f == "u" ) {
63  v = static_cast<double>(m_chronoSvc->chronoDelta(t,IChronoStatSvc::USER));
64  } else if ( f == "s" ) {
65  v = static_cast<double>(m_chronoSvc->chronoDelta(t,IChronoStatSvc::KERNEL));
66  } else if ( f == "r" ) {
67  v = static_cast<double>(m_chronoSvc->chronoDelta(t, IChronoStatSvc::ELAPSED));
68  }
69  return v;
70 }
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PerfMon
a simple malloc wrapper that keeps track of the amount of memory allocated on the heap.
Definition: CallGraphAuditor.cxx:24
PerfMon::PyChrono::m_chronoSvc
ServiceHandle< IChronoStatSvc > m_chronoSvc
Pointer to the IChronoStatSvc.
Definition: PyChrono.h:73
calibdata.exception
exception
Definition: calibdata.py:496
PerfMon::PyChrono::~PyChrono
~PyChrono()
Destructor:
Definition: PyChrono.cxx:43
PerfMon::PyChrono::chronoStop
void chronoStop(const std::string &t)
stop chrono, tagged by its name
Definition: PyChrono.cxx:54
python.PyAthena.v
v
Definition: PyAthena.py:157
PerfMon::PyChrono::chronoDelta
double chronoDelta(const std::string &t, const std::string &f)
return chrono delta time of last start/stop pair
Definition: PyChrono.cxx:58
PerfMon::PyChrono::chronoStart
void chronoStart(const std::string &t)
start chrono, tagged by its name
Definition: PyChrono.cxx:51
PerfMon::PyChrono::PyChrono
PyChrono()
Constructor with parameters:
Definition: PyChrono.cxx:33
PyChrono.h