The Gaudi Framework
v33r0 (d5ea422b)
ITimelineSvc.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIKERNEL_ITIMELINESVC_H
12
#define GAUDIKERNEL_ITIMELINESVC_H
13
14
#include "
GaudiKernel/IService.h
"
15
16
#include <pthread.h>
17
#include <string>
18
19
#include <chrono>
20
21
class
EventContext
;
22
23
struct
TimelineEvent
final {
24
using
Clock
=
std::chrono::high_resolution_clock
;
25
using
time_point
= Clock::time_point;
26
27
pthread_t
thread
;
28
size_t
slot
;
29
size_t
event
;
30
31
std::string
algorithm
;
32
33
time_point
start
;
34
time_point
end
;
35
};
36
37
class
GAUDI_API
ITimelineSvc
:
virtual
public
IService
{
38
39
public
:
41
DeclareInterfaceID
(
ITimelineSvc
, 2, 0 );
42
44
class
TimelineRecorder
final {
45
public
:
46
using
Clock
=
TimelineEvent::Clock
;
47
48
TimelineRecorder
() =
default
;
49
TimelineRecorder
(
TimelineEvent
& record,
std::string
alg
,
const
EventContext
&
ctx
);
50
51
TimelineRecorder
(
const
TimelineRecorder
& ) =
delete
;
52
TimelineRecorder
(
TimelineRecorder
&& other ) : m_record{other.m_record} { other.m_record =
nullptr
; }
53
54
TimelineRecorder
&
operator=
(
TimelineRecorder
&& other ) {
55
std::swap
( m_record, other.m_record );
56
return
*
this
;
57
}
58
59
~TimelineRecorder
() {
60
if
( m_record ) m_record->end = Clock::now();
61
}
62
63
private
:
64
TimelineEvent
* m_record =
nullptr
;
65
};
66
67
virtual
TimelineRecorder
getRecorder(
std::string
alg
,
const
EventContext
&
ctx
) = 0;
68
// Augment a partially pre-filled TimelineEvent object with matching info
69
virtual
bool
getTimelineEvent(
TimelineEvent
& )
const
= 0;
70
virtual
bool
isEnabled()
const
= 0;
71
};
72
73
#endif
ManySmallAlgs.alg
alg
Definition:
ManySmallAlgs.py:79
TimelineEvent::thread
pthread_t thread
Definition:
ITimelineSvc.h:27
std::swap
T swap(T... args)
GaudiPython.Pythonizations.ctx
ctx
Definition:
Pythonizations.py:566
TimelineEvent::algorithm
std::string algorithm
Definition:
ITimelineSvc.h:31
TimelineEvent
Definition:
ITimelineSvc.h:23
EventContext
This class represents an entry point to all the event specific data.
Definition:
EventContext.h:34
std::string
STL class.
TimelineEvent::Clock
std::chrono::high_resolution_clock Clock
Definition:
ITimelineSvc.h:24
TimelineEvent::end
time_point end
Definition:
ITimelineSvc.h:34
std::chrono::high_resolution_clock
TimelineEvent::time_point
Clock::time_point time_point
Definition:
ITimelineSvc.h:25
ITimelineSvc::TimelineRecorder::~TimelineRecorder
~TimelineRecorder()
Definition:
ITimelineSvc.h:59
IService
General service interface definition.
Definition:
IService.h:28
ITimelineSvc::TimelineRecorder::TimelineRecorder
TimelineRecorder(TimelineRecorder &&other)
Definition:
ITimelineSvc.h:52
ITimelineSvc
Definition:
ITimelineSvc.h:37
IService.h
TimelineEvent::start
time_point start
Definition:
ITimelineSvc.h:33
ITimelineSvc::TimelineRecorder::operator=
TimelineRecorder & operator=(TimelineRecorder &&other)
Definition:
ITimelineSvc.h:54
TimelineEvent::event
size_t event
Definition:
ITimelineSvc.h:29
ITimelineSvc::TimelineRecorder
RAII helper to record timeline events.
Definition:
ITimelineSvc.h:44
TimelineEvent::slot
size_t slot
Definition:
ITimelineSvc.h:28
IService::DeclareInterfaceID
DeclareInterfaceID(IService, 4, 0)
InterfaceID.
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:81
GaudiKernel
GaudiKernel
ITimelineSvc.h
Generated on Mon Dec 16 2019 23:26:33 for The Gaudi Framework by
1.8.15