gtsam
3rdparty
Eigen
bench
btl
generic_bench
timers
x86_perf_analyzer.hh
Go to the documentation of this file.
1
//=====================================================
2
// File : x86_perf_analyzer.hh
3
// Author : L. Plagne <laurent.plagne@edf.fr)>
4
// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002
5
//=====================================================
6
//
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; either version 2
10
// of the License, or (at your option) any later version.
11
//
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
//
20
#ifndef _X86_PERF_ANALYSER_HH
21
#define _X86_PERF_ANALYSER_HH
22
23
#include "
x86_timer.hh
"
24
#include "
bench_parameter.hh
"
25
26
template
<
class
ACTION>
27
class
X86_Perf_Analyzer
{
28
public
:
29
X86_Perf_Analyzer
(
unsigned
long
long
nb_sample=
DEFAULT_NB_SAMPLE
):
_nb_sample
(nb_sample),
_chronos
()
30
{
31
MESSAGE
(
"X86_Perf_Analyzer Ctor"
);
32
_chronos
.
find_frequency
();
33
};
34
X86_Perf_Analyzer
(
const
X86_Perf_Analyzer
& ){
35
INFOS
(
"Copy Ctor not implemented"
);
36
exit(0);
37
};
38
~X86_Perf_Analyzer
(
void
){
39
MESSAGE
(
"X86_Perf_Analyzer Dtor"
);
40
};
41
42
43
inline
double
eval_mflops
(
int
size
)
44
{
45
46
ACTION
action
(
size
);
47
48
int
nb_loop=5;
49
double
calculate_time=0.0;
50
double
baseline_time=0.0;
51
52
for
(
int
j
=0 ;
j
< nb_loop ;
j
++){
53
54
_chronos
.
clear
();
55
56
for
(
int
i
=0 ;
i
<
_nb_sample
;
i
++)
57
{
58
_chronos
.
start
();
59
action
.initialize();
60
action
.calculate();
61
_chronos
.
stop
();
62
_chronos
.
add_get_click
();
63
}
64
65
calculate_time += double(
_chronos
.
get_shortest_clicks
())/
_chronos
.
frequency
();
66
67
if
(
j
==0)
action
.check_result();
68
69
_chronos
.
clear
();
70
71
for
(
int
i
=0 ;
i
<
_nb_sample
;
i
++)
72
{
73
_chronos
.
start
();
74
action
.initialize();
75
_chronos
.
stop
();
76
_chronos
.
add_get_click
();
77
78
}
79
80
baseline_time+=double(
_chronos
.
get_shortest_clicks
())/
_chronos
.
frequency
();
81
82
}
83
84
double
corrected_time = (calculate_time-baseline_time)/
double
(nb_loop);
85
86
87
// INFOS("_nb_sample="<<_nb_sample);
88
// INFOS("baseline_time="<<baseline_time);
89
// INFOS("calculate_time="<<calculate_time);
90
// INFOS("corrected_time="<<corrected_time);
91
92
// cout << size <<" "<<baseline_time<<" "<<calculate_time<<" "<<corrected_time<<" "<<action.nb_op_base() << endl;
93
94
return
action
.nb_op_base()/(corrected_time*1000000.0);
95
//return action.nb_op_base()/(calculate_time*1000000.0);
96
}
97
98
private
:
99
100
X86_Timer
_chronos
;
101
unsigned
long
long
_nb_sample
;
102
103
104
};
105
106
107
108
#endif
X86_Timer::find_frequency
void find_frequency(void)
Definition:
x86_timer.hh:84
X86_Timer::get_shortest_clicks
double get_shortest_clicks(void)
Definition:
x86_timer.hh:169
X86_Perf_Analyzer::_nb_sample
unsigned long long _nb_sample
Definition:
x86_perf_analyzer.hh:101
X86_Perf_Analyzer::X86_Perf_Analyzer
X86_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE)
Definition:
x86_perf_analyzer.hh:29
X86_Perf_Analyzer::X86_Perf_Analyzer
X86_Perf_Analyzer(const X86_Perf_Analyzer &)
Definition:
x86_perf_analyzer.hh:34
X86_Timer::clear
void clear(void)
Definition:
x86_timer.hh:204
size
Scalar Scalar int size
Definition:
benchVecAdd.cpp:17
MESSAGE
#define MESSAGE(chain)
Definition:
3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:76
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
X86_Perf_Analyzer::_chronos
X86_Timer _chronos
Definition:
x86_perf_analyzer.hh:100
X86_Timer::start
void start(void)
Definition:
x86_timer.hh:53
X86_Timer::stop
void stop(void)
Definition:
x86_timer.hh:60
X86_Timer::add_get_click
void add_get_click(void)
Definition:
x86_timer.hh:111
X86_Perf_Analyzer
Definition:
x86_perf_analyzer.hh:27
gtsam.examples.DogLegOptimizerExample.action
action
Definition:
DogLegOptimizerExample.py:115
x86_timer.hh
bench_parameter.hh
INFOS
#define INFOS(chain)
Definition:
3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:22
X86_Perf_Analyzer::~X86_Perf_Analyzer
~X86_Perf_Analyzer(void)
Definition:
x86_perf_analyzer.hh:38
DEFAULT_NB_SAMPLE
#define DEFAULT_NB_SAMPLE
Definition:
bench_parameter.hh:48
X86_Timer
Definition:
x86_timer.hh:44
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
X86_Timer::frequency
double frequency(void)
Definition:
x86_timer.hh:67
X86_Perf_Analyzer::eval_mflops
double eval_mflops(int size)
Definition:
x86_perf_analyzer.hh:43
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:44