00001 //===================================================== 00002 // File : mixed_perf_analyzer.hh 00003 // Author : L. Plagne <laurent.plagne@edf.fr)> 00004 // Copyright (C) EDF R&D, mar déc 3 18:59:36 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 _MIXED_PERF_ANALYSER_HH 00021 #define _MIXED_PERF_ANALYSER_HH 00022 00023 #include "x86_perf_analyzer.hh" 00024 #include "portable_perf_analyzer.hh" 00025 00026 // choose portable perf analyzer for long calculations and x86 analyser for short ones 00027 00028 00029 template<class Action> 00030 class Mixed_Perf_Analyzer{ 00031 00032 public: 00033 Mixed_Perf_Analyzer( void ):_x86pa(),_ppa(),_use_ppa(true) 00034 { 00035 MESSAGE("Mixed_Perf_Analyzer Ctor"); 00036 }; 00037 Mixed_Perf_Analyzer( const Mixed_Perf_Analyzer & ){ 00038 INFOS("Copy Ctor not implemented"); 00039 exit(0); 00040 }; 00041 ~Mixed_Perf_Analyzer( void ){ 00042 MESSAGE("Mixed_Perf_Analyzer Dtor"); 00043 }; 00044 00045 00046 inline double eval_mflops(int size) 00047 { 00048 00049 double result=0.0; 00050 if (_use_ppa){ 00051 result=_ppa.eval_mflops(size); 00052 if (_ppa.get_nb_calc()>DEFAULT_NB_SAMPLE){_use_ppa=false;} 00053 } 00054 else{ 00055 result=_x86pa.eval_mflops(size); 00056 } 00057 00058 return result; 00059 } 00060 00061 private: 00062 00063 Portable_Perf_Analyzer<Action> _ppa; 00064 X86_Perf_Analyzer<Action> _x86pa; 00065 bool _use_ppa; 00066 00067 }; 00068 00069 #endif 00070 00071 00072 00073