Commit 77c28d57 authored by Jens Korinth's avatar Jens Korinth

Fix output bug in tapasco-benchmark

* forgot to output final values, resulting in erroneous readouts
* switched back to high_resolution_clock, since wrong values were
  unrelated to the steadiness of the clock
parent 53d35035
......@@ -64,6 +64,9 @@ public:
} while (c == ERR && (fabs(cavg.delta()) > 0.01 || cavg.size() < min_runs));
stop = true;
f.get();
mvprintw(y, x, "Runtime: %12zu cc, Latency: % 12.1f, Min: % 12.1f, Max: % 12.1f, Count: %zu/%zu",
clock_cycles, cavg(), cavg.min(), cavg.max(), cavg.size(), min_runs);
refresh();
move((y+1) % maxy, 0);
if (min) *min = cavg.min();
......@@ -75,12 +78,12 @@ private:
void trigger(volatile bool& stop, uint32_t const clock_cycles, CumulativeAverage<double>& cavg) {
tapasco_res_t res;
while (! stop) {
auto tstart = steady_clock::now();
auto tstart = high_resolution_clock::now();
// if 0, use 1us - 100ms interval (clock period is 10ns)
uint32_t cc = clock_cycles > 0 ? clock_cycles : (rand() % (10000000 - 100) + 100);
if ((res = tapasco.launch_no_return(COUNTER_ID, cc)) != TAPASCO_SUCCESS)
throw Tapasco::tapasco_error(res);
microseconds const d = duration_cast<microseconds>(steady_clock::now() - tstart);
microseconds const d = duration_cast<microseconds>(high_resolution_clock::now() - tstart);
cavg.update(d.count() - cc / 100);
}
}
......
......@@ -36,7 +36,7 @@ public:
int x, y;
getyx(stdscr, y, x);
vector<future<void> > threads;
auto const t_start = steady_clock::now();
auto const t_start = high_resolution_clock::now();
for (size_t t = 0; t < num_threads; ++t)
threads.push_back(async(launch::async, [&]() { run(stop, jobs); }));
auto c = getch();
......@@ -48,7 +48,7 @@ public:
refresh();
usleep(5000000);
auto const j = jobs.load();
auto const t = steady_clock::now();
auto const t = high_resolution_clock::now();
auto const s = duration_cast<seconds>(t - t_start);
auto const v = s.count() > 0 ? static_cast<double>(j) / static_cast<double>(s.count()) : 0.0;
if (v > 10.0) cavg.update(v);
......@@ -59,6 +59,12 @@ public:
stop = true;
for (auto &f : threads)
f.get();
move(y, 0);
clrtoeol();
mvprintw(y, x, "Num threads: % 2zu, jobs/second: % 12.1f, max: % 12.f, min: % 12.1f",
num_threads, cavg(), cavg.max(), cavg.min());
refresh();
move(y+1, 0);
return cavg();
}
......
......@@ -39,9 +39,9 @@ public:
bytes = 0;
int x, y;
getyx(stdscr, y, x);
auto tstart = steady_clock::now();
auto tstart = high_resolution_clock::now();
double b = 0.0;
duration<double> d = steady_clock::now() - tstart;
duration<double> d = high_resolution_clock::now() - tstart;
future<void> f = async(launch::async, [&]() { transfer(stop, chunk_sz, opmask); });
auto c = getch();
do {
......@@ -50,13 +50,17 @@ public:
refresh();
usleep(1000000);
b = bytes.load() / (1024.0 * 1024.0);
d = steady_clock::now() - tstart;
d = high_resolution_clock::now() - tstart;
// exit gracefully on ctrl+c
c = getch();
if (c == 3) { endwin(); exit(3); }
} while (c == ERR && (fabs(cavg.update(b / d.count())) > 0.1 || cavg.size() < 30));
stop = true;
f.get();
mvprintw(y, x, "Chunk size: %8.2f KiB, Mask: %s, Speed: %8.2f MiB/s",
cs, ms.c_str(), cavg());
refresh();
move(y+1, 0);
return cavg();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment