intel_bench_fixed_size.hh
Go to the documentation of this file.
00001 //=====================================================
00002 // File   :  intel_bench_fixed_size.hh
00003 // Author :  L. Plagne <laurent.plagne@edf.fr)>        
00004 // Copyright (C) EDF R&D,  mar déc 3 18:59:37 CET 2002
00005 //=====================================================
00006 // 
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 // 
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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     //INFOS("nb_init="<<nb_init);
00037     //INFOS("time_baseline="<<time_baseline);
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


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:32:49