RFA: Time Benchmarks
Jeffrey Oldham
oldham at codesourcery.com
Tue Jul 24 20:13:31 UTC 2001
This patch has been awaiting response since 05Jul. It is OK to commit
this patch?
When running benchmarks, knowing the running time is frequently
useful. Currently, only the number of megaflops is computed. This
patch adds a "--report-time" command-line option which substitutes
running time in seconds for megaflops.
2001-07-05 Jeffrey D. Oldham <oldham at codesourcery.com>
* Benchmark.cmpl.cpp (Benchmark::Benchmark): Initialize
report_time_m. Process "--report-time".
(Benchmark::usage): Add "--report-time" explanation.
(Benchmark::runImplementation): Revise storage of time xor Mflops.
* Benchmark.h (Benchmark): Add report_time_m.
Tested on sequential Linux using gcc3.0 and by building and running three benchmarks
Approved by ???you???
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: Benchmark.cmpl.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/Benchmark.cmpl.cpp,v
retrieving revision 1.44
diff -c -p -r1.44 Benchmark.cmpl.cpp
*** Benchmark.cmpl.cpp 2000/06/30 02:02:50 1.44
--- Benchmark.cmpl.cpp 2001/07/06 02:27:43
*************** Benchmark::Benchmark(int argc, char *arg
*** 76,81 ****
--- 76,82 ----
print_m = true;
diags_m = true;
+ report_time_m = false;
// Default Inform object has null prefix and only prints from context 0:
*************** Benchmark::Benchmark(int argc, char *arg
*** 225,230 ****
--- 226,236 ----
print_m = false;
++i;
}
+ else if (strcmp("--report-time", argv[i]) == 0)
+ {
+ report_time_m = true;
+ ++i;
+ }
else if (strcmp("--num-patches", argv[i]) == 0)
{
setNumPatches_m = true;
*************** void Benchmark::usage(const char *name)
*** 278,284 ****
<< " V1, V2, etc.\n"
<< "--no-print.........................don't print anything (useful if\n"
<< " profiling using an external tool).\n"
! << "--n-idiags.........................suppress diagnostic output.\n"
<< "--iters N..........................run benchmark for N iterations\n"
<< " (no effect if using SGI timers).\n"
<< "--samples N........................repeat runs N time.\n"
--- 284,291 ----
<< " V1, V2, etc.\n"
<< "--no-print.........................don't print anything (useful if\n"
<< " profiling using an external tool).\n"
! << "--no-diags.........................suppress diagnostic output.\n"
! << "--report-time......................print time, not Mflops.\n"
<< "--iters N..........................run benchmark for N iterations\n"
<< " (no effect if using SGI timers).\n"
<< "--samples N........................repeat runs N time.\n"
*************** void Benchmark::runImplementation(Implem
*** 637,645 ****
double timeper = total / double(iters);
! // Compute the MOps and store it.
! times[i] = impl->opCount() / timeper / 1.0e6;
// If we're testing results and we're printing, do this now.
--- 644,655 ----
double timeper = total / double(iters);
! // Either store the running time or the MOps.
! if (report_time_m)
! times[i] = total;
! else
! times[i] = impl->opCount() / timeper / 1.0e6;
// If we're testing results and we're printing, do this now.
Index: Benchmark.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/Benchmark.h,v
retrieving revision 1.27
diff -c -p -r1.27 Benchmark.h
*** Benchmark.h 2000/06/30 02:02:50 1.27
--- Benchmark.h 2001/07/06 02:27:43
*************** private:
*** 199,209 ****
bool setSamples_m;
//---------------------------------------------------------------------------
! // If true, we are supposed to display results or show diagnostic output.
bool print_m;
bool diags_m;
!
// --------------------------------------------------------------------------
// Points to the Inform object pointer used for printing output:
--- 199,211 ----
bool setSamples_m;
//---------------------------------------------------------------------------
! // If true, we are supposed to display results or show diagnostic
! // output or print running time, not Mflops.
bool print_m;
bool diags_m;
! bool report_time_m;
!
// --------------------------------------------------------------------------
// Points to the Inform object pointer used for printing output:
More information about the pooma-dev
mailing list