/*************************************************************************** * blitz/benchext.h BenchmarkExt classes (Benchmarks with external * control) * * Copyright (C) 1997,1998 Todd Veldhuizen * * 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. * * Suggestions: blitz-suggest@cybervision.com * Bugs: blitz-bugs@cybervision.com * * For more information, please see the Blitz++ Home Page: * http://seurat.uwaterloo.ca/blitz/ * *************************************************************************** * $Log: not supported by cvs2svn $ * Revision 1.2 1998/03/14 00:04:47 tveldhui * 0.2-alpha-05 * * Revision 1.1 1997/07/16 14:51:20 tveldhui * Update: Alpha release 0.2 (Arrays) * */ #ifndef BZ_BENCHEXT_H #define BZ_BENCHEXT_H #ifndef BZ_MATRIX_H #include #endif #ifndef BZ_TIMER_H #include #endif #include // NEEDS_WORK: replace use of const char* with , once standard // library is widely supported. BZ_NAMESPACE(blitz) // Declaration of class BenchmarkExt // The template parameter T is the parameter type which is varied in // the benchmark. Typically T will be an unsigned, and will represent // the length of a vector, size of an array, etc. template class BenchmarkExt { public: typedef P_parameter T_parameter; BenchmarkExt(const char* description, int numImplementations); ~BenchmarkExt(); void setNumParameters(int numParameters); void setParameterVector(Vector parms); void setParameterDescription(const char* string); void setIterations(Vector iters); void setFlopsPerIteration(Vector flopsPerIteration); void setRateDescription(const char* string); void beginBenchmarking(); void beginImplementation(const char* description); _bz_bool doneImplementationBenchmark() const; T_parameter getParameter() const; long getIterations() const; inline void start(); inline void stop(); void startOverhead(); void stopOverhead(); void endImplementation(); void endBenchmarking(); double getMflops(unsigned implementation, unsigned parameterNum) const; void saveMatlabGraph(const char* filename) const; protected: BenchmarkExt(const BenchmarkExt&) { } void operator=(const BenchmarkExt&) { } enum { initializing, benchmarking, benchmarkingImplementation, running, runningOverhead, done } state_; unsigned numImplementations_; unsigned implementationNumber_; const char* description_; Vector implementationDescriptions_; Matrix times_; // Elapsed time Vector parameters_; Vector iterations_; Vector flopsPerIteration_; Timer timer_; Timer overheadTimer_; const char* parameterDescription_; const char* rateDescription_; int numParameters_; int parameterNumber_; }; BZ_NAMESPACE_END #include #endif // BZ_BENCHEXT_H