summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-04 00:42:38 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commit349219c14875705b8142d599f6af153d22a9a00e (patch)
treeb59e867498163275218f9ddd4022539cf585c841 /src/main.c
parenta8d46571cebb7f14501fa7bcf3c2eb86c473d8b2 (diff)
benchmark: move benchmark_dump() outside the library
The benchmark_dump() is only used by the osmo-gapk binary, and is intended to prepare and print benchmarking results to stderr, what is most likely unusable for the library users.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b9faeb2..b893f34 100644
--- a/src/main.c
+++ b/src/main.c
@@ -310,6 +310,39 @@ check_options(struct gapk_state *gs)
return 0;
}
+static void
+benchmark_dump(void)
+{
+ int i, j;
+
+ for (i = 0; i < _CODEC_MAX; i++) {
+ struct osmo_gapk_bench_cycles *bc = &osmo_gapk_bench_codec[i];
+ unsigned long long total;
+
+ if (bc->enc_used) {
+ total = 0;
+ for (j = 0; j < bc->enc_used; j++)
+ total += bc->enc[j];
+
+ fprintf(stderr,
+ "Codec %u (ENC): %llu cycles for %u frames => "
+ "%llu cycles/frame\n", i, total, bc->enc_used,
+ total / bc->enc_used);
+ }
+
+ if (bc->dec_used) {
+ total = 0;
+ for (j = 0; j < bc->dec_used; j++)
+ total += bc->dec[j];
+
+ fprintf(stderr,
+ "Codec %u (DEC): %llu cycles for %u frames => "
+ "%llu cycles/frame\n", i, total, bc->dec_used,
+ total / bc->dec_used);
+ }
+ }
+}
+
static int
files_open(struct gapk_state *gs)
{