ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHTimeServer.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHTimeServer.h
1
#ifndef PHOOL_PHTIMESERVER_H
2
#define PHOOL_PHTIMESERVER_H
3
12
#include "
PHTimer.h
"
13
14
#include <iostream>
15
#include <map>
16
#include <memory>
17
#include <string>
18
#include <utility>
19
25
class
PHTimeServer
26
{
27
public
:
29
class
timer
30
{
31
public
:
32
timer
(
const
std::string& key,
unsigned
short
uid)
33
:
_timer
(new
PHTimer
(key))
34
,
_uid
(uid)
35
{
36
}
37
38
PHTimer
*
get
(
void
)
39
{
40
return
_timer
.get();
41
}
42
43
const
PHTimer
*
get
(
void
)
const
44
{
45
return
_timer
.get();
46
}
47
48
unsigned
short
get_uid
(
void
)
const
49
{
50
return
_uid
;
51
}
52
53
private
:
54
55
std::shared_ptr<PHTimer>
_timer
;
56
unsigned
short
_uid
;
57
};
58
60
static
PHTimeServer
*
get
(
void
)
61
{
62
static
PHTimeServer
* _server =
new
PHTimeServer
();
63
return
_server;
64
}
65
67
virtual
~PHTimeServer
()
68
{
69
}
70
72
timer
insert_new
(
const
std::string&);
73
75
timer
insert_new_single_shot
(
const
std::string&);
76
78
timer
get_timer
(
const
std::string&);
79
81
timer
get_single_shot_timer
(
const
std::string&);
82
84
void
print
(std::ostream& out = std::cout)
const
;
85
87
void
print_stat
(std::ostream& out = std::cout)
const
;
88
89
protected
:
91
PHTimeServer
()
92
:
_timer_id
(0)
93
,
_single_shot_timer_id
(0)
94
{
95
}
96
97
private
:
99
typedef
std::map<std::string, timer>
time_map
;
100
102
typedef
std::map<std::string, timer>::iterator
time_iterator
;
103
105
typedef
std::map<std::string, timer>::const_iterator
const_time_iterator
;
106
108
time_map
_timers
;
109
111
time_map
_single_shot_timers
;
112
114
unsigned
short
_timer_id
;
115
117
unsigned
short
_single_shot_timer_id
;
118
119
public
:
121
class
iterator
122
{
123
public
:
125
PHTimeServer::timer
*
next
()
126
{
127
if
(
_iter
==
_map
.end())
return
nullptr
;
128
PHTimeServer::timer
* out(&
_iter
->second);
129
++
_iter
;
130
return
out;
131
}
132
134
PHTimeServer::timer
*
current
()
135
{
136
if
(
_iter
==
_map
.end())
return
nullptr
;
137
return
&
_iter
->second;
138
}
139
140
protected
:
142
explicit
iterator
(
PHTimeServer::time_map
& map)
143
:
_map
(map)
144
,
_iter
(
_map
.begin())
145
{
146
}
147
148
private
:
150
PHTimeServer::time_map
_map
;
151
153
PHTimeServer::time_iterator
_iter
;
154
155
friend
class
PHTimeServer
;
156
};
157
159
iterator
range
(
void
) {
return
iterator
(
_timers
); }
160
};
161
#endif
coresoftware
blob
master
offline
framework
phool
PHTimeServer.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:34
using
1.8.2 with
ECCE GitHub integration