aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--include/osmocom/gapk/benchmark.h2
-rw-r--r--src/benchmark.c33
-rw-r--r--src/main.c33
3 files changed, 33 insertions, 35 deletions
diff --git a/include/osmocom/gapk/benchmark.h b/include/osmocom/gapk/benchmark.h
index a404168..6cfc074 100644
--- a/include/osmocom/gapk/benchmark.h
+++ b/include/osmocom/gapk/benchmark.h
@@ -54,5 +54,3 @@ static inline void benchmark_stop(enum osmo_gapk_codec_type codec,
#define BENCHMARK_STOP(x,y) _cycles_stop = get_cycles(); \
benchmark_stop(x, y, _cycles_stop - _cycles_start); \
} while (0)
-
-void benchmark_dump(void);
diff --git a/src/benchmark.c b/src/benchmark.c
index 59f5965..3dead5a 100644
--- a/src/benchmark.c
+++ b/src/benchmark.c
@@ -22,36 +22,3 @@
#include <osmocom/gapk/benchmark.h>
struct osmo_gapk_bench_cycles osmo_gapk_bench_codec[_CODEC_MAX];
-
-void benchmark_dump(void)
-{
- int i;
-
- for (i = 0; i < _CODEC_MAX; i++) {
- struct osmo_gapk_bench_cycles *bc = &osmo_gapk_bench_codec[i];
- unsigned long long total;
- int j;
-
- 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);
- }
- }
-}
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)
{