1 | //=====================================================
|
---|
2 | // File : intel_bench_fixed_size.hh
|
---|
3 | // Author : L. Plagne <laurent.plagne@edf.fr)>
|
---|
4 | // Copyright (C) EDF R&D, mar déc 3 18:59:37 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 _BENCH_FIXED_SIZE_HH_
|
---|
21 | #define _BENCH_FIXED_SIZE_HH_
|
---|
22 |
|
---|
23 | #include "utilities.h"
|
---|
24 | #include "function_time.hh"
|
---|
25 |
|
---|
26 | template <class Action>
|
---|
27 | double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long long & nb_init)
|
---|
28 | {
|
---|
29 |
|
---|
30 | Action action(size);
|
---|
31 |
|
---|
32 | double time_baseline=time_init(nb_init,action);
|
---|
33 |
|
---|
34 | while (time_baseline < MIN_TIME) {
|
---|
35 |
|
---|
36 | //INFOS("nb_init="<<nb_init);
|
---|
37 | //INFOS("time_baseline="<<time_baseline);
|
---|
38 | nb_init*=2;
|
---|
39 | time_baseline=time_init(nb_init,action);
|
---|
40 | }
|
---|
41 |
|
---|
42 | time_baseline=time_baseline/(double(nb_init));
|
---|
43 |
|
---|
44 | double time_action=time_calculate(nb_calc,action);
|
---|
45 |
|
---|
46 | while (time_action < MIN_TIME) {
|
---|
47 |
|
---|
48 | nb_calc*=2;
|
---|
49 | time_action=time_calculate(nb_calc,action);
|
---|
50 | }
|
---|
51 |
|
---|
52 | INFOS("nb_init="<<nb_init);
|
---|
53 | INFOS("nb_calc="<<nb_calc);
|
---|
54 |
|
---|
55 |
|
---|
56 | time_action=time_action/(double(nb_calc));
|
---|
57 |
|
---|
58 | action.check_result();
|
---|
59 |
|
---|
60 | time_action=time_action-time_baseline;
|
---|
61 |
|
---|
62 | return action.nb_op_base()/(time_action*1000000.0);
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | #endif
|
---|