STL_perf_analyzer.hh
Go to the documentation of this file.
1 //=====================================================
2 // File : STL_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 _STL_PERF_ANALYSER_HH
21 #define _STL_PERF_ANALYSER_HH
22 
23 #include "STL_timer.hh"
24 #include "bench_parameter.hh"
25 
26 template<class ACTION>
28 public:
29  STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos()
30  {
31  MESSAGE("STL_Perf_Analyzer Ctor");
32  };
34  INFOS("Copy Ctor not implemented");
35  exit(0);
36  };
38  MESSAGE("STL_Perf_Analyzer Dtor");
39  };
40 
41 
42  inline double eval_mflops(int size)
43  {
44 
45  ACTION action(size);
46 
48 
49  do {
50 
51  action.initialize();
52  } while (_chronos.check());
53 
54  double baseline_time=_chronos.get_time();
55 
57  do {
58  action.initialize();
59  action.calculate();
60  } while (_chronos.check());
61 
62  double calculate_time=_chronos.get_time();
63 
64  double corrected_time=calculate_time-baseline_time;
65 
66  // cout << size <<" "<<baseline_time<<" "<<calculate_time<<" "<<corrected_time<<" "<<action.nb_op_base() << endl;
67 
68  return action.nb_op_base()/(corrected_time*1000000.0);
69  //return action.nb_op_base()/(calculate_time*1000000.0);
70 
71  }
72 private:
73 
75  unsigned long long _nb_sample;
76 
77 
78 };
79 
80 
81 
82 #endif
STL_Perf_Analyzer(const STL_Perf_Analyzer &)
double get_time(void)
Definition: STL_timer.hh:60
void start_baseline(unsigned int r)
Definition: STL_timer.hh:42
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
void start(unsigned int r)
Definition: STL_timer.hh:34
STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE)
double eval_mflops(int size)
#define DEFAULT_NB_SAMPLE
bool check()
Definition: STL_timer.hh:48
unsigned long long _nb_sample


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:44:50