[beast: 12/17] BSE: tests/firhandle.cc: eliminate slow runs, use new benchmark code
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 12/17] BSE: tests/firhandle.cc: eliminate slow runs, use new benchmark code
- Date: Fri, 20 Nov 2015 22:08:10 +0000 (UTC)
commit d32fb8810aa5a79da5d82ccc8c785ecc040df152
Author: Tim Janik <timj gnu org>
Date: Tue Nov 10 17:31:19 2015 +0100
BSE: tests/firhandle.cc: eliminate slow runs, use new benchmark code
Signed-off-by: Tim Janik <timj gnu org>
bse/tests/firhandle.cc | 39 +++++++++++++++------------------------
1 files changed, 15 insertions(+), 24 deletions(-)
---
diff --git a/bse/tests/firhandle.cc b/bse/tests/firhandle.cc
index 5e6c9ed..a4e63c3 100644
--- a/bse/tests/firhandle.cc
+++ b/bse/tests/firhandle.cc
@@ -10,6 +10,7 @@
#include <complex>
#include <vector>
+using namespace Rapicorn::Test;
using Rapicorn::string_format;
using std::vector;
using std::min;
@@ -232,32 +233,22 @@ test_with_sine_sweep (FirHandleType type)
TCMP (band_max (scanned_freq, scanned_abs_phase_diff, 0, 5500), <, 0.00002);
}
TDONE();
+
/* test speed */
- double samples_per_second = 0;
- if (Rapicorn::Test::slow())
+ if (1)
{
- const guint RUNS = 10;
- GTimer *timer = g_timer_new();
- const guint dups = TEST_CALIBRATION (50.0, read_through (fir_handle_sin));
-
- double m = 9e300;
- for (guint i = 0; i < RUNS; i++)
- {
- g_timer_start (timer);
- for (guint j = 0; j < dups; j++)
- read_through (fir_handle_sin);
- g_timer_stop (timer);
- double e = g_timer_elapsed (timer, NULL);
- if (e < m)
- m = e;
- }
- samples_per_second = sweep_sin.size() / (m / dups);
- printout (" %-28s : %+.14f samples/second",
- string_format ("%s O64 mono", handle_name (type)).c_str(),
- samples_per_second);
- printout (" %-28s : %+.14f streams",
- string_format ("CPU %s mono", handle_name (type)).c_str(),
- samples_per_second / 44100.0);
+ const uint RUNS = 3;
+ const uint bytes_per_run = sizeof (float) * gsl_data_handle_n_values (fir_handle_sin);
+ auto loop = [&fir_handle_sin] () {
+ for (uint j = 0; j < RUNS; j++)
+ read_through (fir_handle_sin);
+ };
+ Rapicorn::Test::Timer timer (0.03);
+ const double bench_time = timer.benchmark (loop);
+ String name = string_format ("%s O64 mono", handle_name (type));
+ const double samples_per_second = RUNS * sweep_sin.size() / bench_time;
+ TPASS ("%-20s benchmark # timing: %+.1f streams, throughput=%.1fMB/s\n",
+ name, samples_per_second / 44100.0, RUNS * bytes_per_run / bench_time / 1048576.);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]