PhoenixHardware
0.2.0
Tools to get hardware information
Toggle main menu visibility
Loading...
Searching...
No Matches
PProfiler.cpp
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : CeCILL-C
5
****************************************/
6
7
8
9
10
#include "
PProfiler.h
"
11
13
PProfiler::PProfiler
(){
14
initialisationPProfiler
();
15
}
16
18
20
PProfiler::PProfiler
(
const
PProfiler
& other){
21
copyPProfiler
(other);
22
}
23
25
PProfiler::~PProfiler
(){
26
27
}
28
30
33
PProfiler
&
PProfiler::operator =
(
const
PProfiler
& other){
34
copyPProfiler
(other);
35
return
*
this
;
36
}
37
39
43
size_t
PProfiler::addFunction
(
const
std::string & name,
size_t
nbThread){
44
PFunctionPerf
perf(name);
45
if
(nbThread < 1lu){nbThread = 1;}
46
perf.
resize
(nbThread);
47
p_vecFunctionPerf
.push_back(perf);
48
return
p_vecFunctionPerf
.size() - 1lu;
49
}
50
52
55
void
PProfiler::rename
(
size_t
index,
const
std::string & name){
56
p_vecFunctionPerf
[index].setName(name);
57
}
58
60
63
void
PProfiler::start
(
size_t
index,
size_t
threadIndex){
64
p_vecFunctionPerf
[index].start(threadIndex);
65
}
66
68
71
void
PProfiler::stop
(
size_t
index,
size_t
threadIndex){
72
p_vecFunctionPerf
[index].stop(threadIndex);
73
}
74
76
79
void
PProfiler::reset
(
size_t
index,
size_t
threadIndex){
80
p_vecFunctionPerf
[index].reset(threadIndex);
81
}
82
84
void
PProfiler::reset
(){
85
for
(PVecFunctionPerf::iterator it(
p_vecFunctionPerf
.begin()); it !=
p_vecFunctionPerf
.end(); ++it){
86
it->reset();
87
}
88
}
89
91
93
void
PProfiler::print
(std::ostream & out)
const
{
94
for
(PVecFunctionPerf::const_iterator it(
p_vecFunctionPerf
.begin()); it !=
p_vecFunctionPerf
.end(); ++it){
95
it->print(out);
96
}
97
}
98
100
102
void
PProfiler::printCsvHeader
(std::ostream & out)
const
{
103
out <<
"function,nbCall,fullTime,averageTime,stdTime,minTime,maxTime"
<< std::endl;
104
}
105
107
109
void
PProfiler::printCsv
(std::ostream & out)
const
{
110
for
(PVecFunctionPerf::const_iterator it(
p_vecFunctionPerf
.begin()); it !=
p_vecFunctionPerf
.end(); ++it){
111
it->printCsv(out);
112
}
113
}
114
116
118
void
PProfiler::copyPProfiler
(
const
PProfiler
& other){
119
p_vecFunctionPerf
= other.
p_vecFunctionPerf
;
120
}
121
123
void
PProfiler::initialisationPProfiler
(){
124
125
}
126
127
128
129
130
PProfiler.h
PFunctionPerf
Performances of a function.
Definition
PFunctionPerf.h:17
PFunctionPerf::resize
void resize(size_t nbThread)
Resize the PFunctionPerf by respect to the number of thread which call the function.
Definition
PFunctionPerf.cpp:48
PProfiler::initialisationPProfiler
void initialisationPProfiler()
Initialisation function of the class PProfiler.
Definition
PProfiler.cpp:123
PProfiler::printCsvHeader
void printCsvHeader(std::ostream &out=std::cout) const
Print header of all the PFunctionPerf of the PProfiler in CSV format.
Definition
PProfiler.cpp:102
PProfiler::start
void start(size_t index, size_t threadIndex=0lu)
Start the given PFunctionPerf.
Definition
PProfiler.cpp:63
PProfiler::PProfiler
PProfiler()
Default constructor of PProfiler.
Definition
PProfiler.cpp:13
PProfiler::print
void print(std::ostream &out=std::cout) const
Print all the PFunctionPerf of the PProfiler.
Definition
PProfiler.cpp:93
PProfiler::printCsv
void printCsv(std::ostream &out=std::cout) const
Print all the PFunctionPerf of the PProfiler in CSV format.
Definition
PProfiler.cpp:109
PProfiler::copyPProfiler
void copyPProfiler(const PProfiler &other)
Copy function of PProfiler.
Definition
PProfiler.cpp:118
PProfiler::rename
void rename(size_t index, const std::string &name)
Rename a function.
Definition
PProfiler.cpp:55
PProfiler::operator=
PProfiler & operator=(const PProfiler &other)
Definition of equal operator of PProfiler.
Definition
PProfiler.cpp:33
PProfiler::~PProfiler
virtual ~PProfiler()
Destructor of PProfiler.
Definition
PProfiler.cpp:25
PProfiler::addFunction
size_t addFunction(const std::string &name, size_t nbThread=1lu)
Add a function to profile.
Definition
PProfiler.cpp:43
PProfiler::reset
void reset()
Reset all the function perf.
Definition
PProfiler.cpp:84
PProfiler::p_vecFunctionPerf
PVecFunctionPerf p_vecFunctionPerf
Vector of performances for all registered functions.
Definition
PProfiler.h:42
PProfiler::stop
void stop(size_t index, size_t threadIndex=0lu)
Stop the given PFunctionPerf.
Definition
PProfiler.cpp:71
src
PProfiler.cpp
Generated by
1.17.0