Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _BENCH_FIXED_SIZE_HH_
00021 #define _BENCH_FIXED_SIZE_HH_
00022
00023 #include "utilities.h"
00024 #include "function_time.hh"
00025
00026 template <class Action>
00027 double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long long & nb_init)
00028 {
00029
00030 Action action(size);
00031
00032 double time_baseline=time_init(nb_init,action);
00033
00034 while (time_baseline < MIN_TIME) {
00035
00036
00037
00038 nb_init*=2;
00039 time_baseline=time_init(nb_init,action);
00040 }
00041
00042 time_baseline=time_baseline/(double(nb_init));
00043
00044 double time_action=time_calculate(nb_calc,action);
00045
00046 while (time_action < MIN_TIME) {
00047
00048 nb_calc*=2;
00049 time_action=time_calculate(nb_calc,action);
00050 }
00051
00052 INFOS("nb_init="<<nb_init);
00053 INFOS("nb_calc="<<nb_calc);
00054
00055
00056 time_action=time_action/(double(nb_calc));
00057
00058 action.check_result();
00059
00060 time_action=time_action-time_baseline;
00061
00062 return action.nb_op_base()/(time_action*1000000.0);
00063
00064 }
00065
00066 #endif