mirror of https://gerrit.osmocom.org/gapk
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.
This commit is contained in:
parent
a8d46571ce
commit
349219c148
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
src/main.c
33
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue