Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  mean.cxx   Sprache: C

 
//=====================================================
// File   :  mean.cxx
// Author :  L. Plagne <laurent.plagne@edf.fr)>        
// Copyright (C) EDF R&D,  lun sep 30 14:23:15 CEST 2002
//=====================================================
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// 
#include "utilities.h"
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "bench_parameter.hh"
#include "utils/xy_file.hh"
#include <set>

using namespace std;

double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max);

class Lib_Mean{

public:
  Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){
    MESSAGE("Lib_mean Default Ctor");
    MESSAGE("!!! should not be used");
    exit(0);
  }
  Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){
    MESSAGE("Lib_mean Ctor");
  }
  Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){
    MESSAGE("Lib_mean Copy Ctor");
  }
  ~Lib_Mean( void ){
    MESSAGE("Lib_mean Dtor");
  }
    
  double _mean_in_cache;
  double _mean_out_of_cache;
  string _lib_name;

  bool operator < ( const Lib_Mean &right) const 
  {
    //return ( this->_mean_out_of_cache > right._mean_out_of_cache) ;
    return ( this->_mean_in_cache > right._mean_in_cache) ;
  }

}; 


int main( int argc , char *argv[] )
{

  if (argc<6){
    INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2...");
    exit(0);
  }
  INFOS(argc);

  int min_in_cache=atoi(argv[2]);
  int max_in_cache=atoi(argv[3]);
  int min_out_of_cache=atoi(argv[4]);
  int max_out_of_cache=atoi(argv[5]);


  multiset<Lib_Mean> s_lib_mean ;

  for (int i=6;i<argc;i++){
    
    string filename=argv[i];
    
    INFOS(filename);

    double mic=0;
    double moc=0;

    {
      
      vector<int> tab_sizes;
      vector<double> tab_mflops;

      read_xy_file(filename,tab_sizes,tab_mflops);

      mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache);
      moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache);

      Lib_Mean cur_lib_mean(filename,mic,moc);
      
      s_lib_mean.insert(cur_lib_mean); 

    }   
           
  }


  cout << "" << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;
  cout << " " << endl ;

  multiset<Lib_Mean>::iterator is = s_lib_mean.begin();
  Lib_Mean best(*is);  
  

  for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){

    cout << " " << endl ;
    cout << " " << endl ;
    cout << " " << endl ;
    cout << " " << endl ;
    cout << " " << endl ;
    cout << " " << endl ;
    cout << " " << endl ;
  
  }

  cout << "
" << argv[1] << " "> in cache
mean perf
Mflops
in cache
% best
"> out of cache
mean perf
Mflops
out of cache
% best
details comments
" << is->_lib_name << " " << is->_mean_in_cache << " " << 100*(is->_mean_in_cache/best._mean_in_cache) << " " << is->_mean_out_of_cache << " " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " " << 
      "#"<<is->_lib_name<<"_"<<argv[1]<<"\">snippet</a>/"
      "
#"<<is->_lib_name<<"_flags\">flags</a>  </TD>" << endl ;
    cout << "
" << 
      "#"<<is->_lib_name<<"_comments\">click here</a>  </TD>" << endl ;
    cout << "
"
 << endl ;

  ofstream output_file ("../order_lib",ios::out) ;
  
  for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){
    output_file << is->_lib_name << endl ;
  }

  output_file.close();

}

double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max){
  
  int size=tab_sizes.size();
  int nb_sample=0;
  double mean=0.0;

  for (int i=0;i<size;i++){
    
    
    if ((tab_sizes[i]>=size_min)&&(tab_sizes[i]<=size_max)){
      
      nb_sample++;
      mean+=tab_mflops[i];

    }

    
  }

  if (nb_sample==0){
    INFOS("no data for mean calculation");
    return 0.0;
  }

  return mean/nb_sample;
}

  


95%


¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge