diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-04 02:06:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-04 02:06:00 +0000 |
commit | 6d596885a8a98fd050a16e3584d25f128d82cd68 (patch) | |
tree | 7ad37974d3535242375656ed3285161c182c5e6b /Carpet/CarpetLib/src/timestat.cc | |
parent | 91295d2b515b078b624994b18e7a894f3d21e892 (diff) |
CarpetLib: Collect more timing information
Extend the CarpetLib timers so that they also count the number of
bytes transmitted in addition to the wall time.
darcs-hash:20060904020649-dae7b-7a18c2fbe2de09d662b4154a3ae2e553ad57c12b.gz
Diffstat (limited to 'Carpet/CarpetLib/src/timestat.cc')
-rw-r--r-- | Carpet/CarpetLib/src/timestat.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/Carpet/CarpetLib/src/timestat.cc b/Carpet/CarpetLib/src/timestat.cc index f5116481f..88987742f 100644 --- a/Carpet/CarpetLib/src/timestat.cc +++ b/Carpet/CarpetLib/src/timestat.cc @@ -18,17 +18,25 @@ using namespace std; timestat::timestat () - : wtime(0.0), wtime2(0.0), wmin(0.0), wmax(0.0), count(0.0), + : wtime(0.0), wtime2(0.0), wmin(0.0), wmax(0.0), + bytes(0.0), bytes2(0.0), bmin(0.0), bmax(0.0), + count(0.0), running(false) { } -void timestat::addstat (double const t) +void timestat::addstat (double const t, double const b) { wtime += t; wtime2 += t*t; wmin = min (wmin, t); wmax = max (wmax, t); + + bytes += b; + bytes2 += b*b; + bmin = min (bmin, b); + bmax = max (bmax, b); + ++count; } @@ -39,12 +47,12 @@ void timestat::start () starttime = MPI_Wtime(); } -void timestat::stop () +void timestat::stop (double const b) { assert (running); running = false; double const endtime = MPI_Wtime(); - addstat (endtime - starttime); + addstat (endtime - starttime, b); } @@ -53,13 +61,20 @@ ostream& operator<< (ostream& os, const timestat& wt) { double const avg = wt.wtime / wt.count; double const stddev = sqrt (max (0.0, wt.wtime2 / wt.count - pow (avg, 2))); + double const bavg = wt.bytes / wt.count; + double const bstddev = sqrt (max (0.0, wt.bytes2 / wt.count - pow (bavg, 2))); os << "timestat[seconds]:" << " cnt: " << wt.count - << " sum: " << wt.wtime + << " time: sum: " << wt.wtime << " avg: " << avg << " stddev: " << stddev << " min: " << wt.wmin - << " max: " << wt.wmax; + << " max: " << wt.wmax + << " bytes: sum: " << wt.bytes + << " avg: " << bavg + << " stddev: " << bstddev + << " min: " << wt.bmin + << " max: " << wt.bmax; return os; } |