00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef IPL_COUNTER_H 00012 #define IPL_COUNTER_H 00013 00014 /*************************************************************************** 00015 * IplCounter - a simple megaflops counter that accesses hardware counters 00016 * for measureing megaflop performance. 00017 * 00018 * To use these counters: 00019 * 1. Create a counter. 00020 * example: Counter FFTcounter("FFT"); 00021 * 00022 * 2. Locate the function which you would like to measure and start the 00023 * counter by placing the startCounter() method before it. Then, stop 00024 * the counter after it by using the stopCounter() method. 00025 * example: FFTcounter.startCounter(); 00026 * fft->transform(....); 00027 * FFTcounter.stopCounter(); 00028 * 00029 * 3. Use the printIt() method to print to the screen. 00030 * example: FFTcounter.printIt(); 00031 * 00032 ***************************************************************************/ 00033 00034 // include files 00035 #include "Utility/Inform.h" 00036 #include "Utility/Pstring.h" 00037 00038 00039 class IplCounter 00040 { 00041 public: 00042 // constructor 00043 IplCounter(const char *category); 00044 00045 // destructor 00046 ~IplCounter(); 00047 00048 // counter operations 00049 void startCounter(); 00050 void stopCounter(); 00051 void printIt(); 00052 00053 private: 00054 #if defined(IPL_LONGLONG) 00055 typedef long long CounterLong; 00056 #else 00057 typedef long CounterLong; 00058 #endif 00059 00060 CounterLong totalcyc_m; 00061 CounterLong totalinst_m; 00062 CounterLong c0_m; 00063 CounterLong c21_m; 00064 00065 int e0_m; 00066 int e1_m; 00067 int gen_start_m; 00068 int gen_read_m; 00069 00070 string category_m; 00071 Inform msg_m; 00072 }; 00073 00074 #endif 00075 00076 /*************************************************************************** 00077 * $RCSfile: IplCounter.h,v $ $Author: adelmann $ 00078 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $ 00079 ***************************************************************************/ 00080 00081 /*************************************************************************** 00082 * $RCSfile: addheaderfooter,v $ $Author: adelmann $ 00083 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $ 00084 * IPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $ 00085 ***************************************************************************/ 00086