diff options
Diffstat (limited to 'src/benchmark.c')
-rw-r--r-- | src/benchmark.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/benchmark.c b/src/benchmark.c new file mode 100644 index 0000000..e2c14a6 --- /dev/null +++ b/src/benchmark.c @@ -0,0 +1,55 @@ +/* + * This file is part of gapk (GSM Audio Pocket Knife). + * + * gapk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gapk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gapk. If not, see <http://www.gnu.org/licenses/>. + * + * (C) 2014 Harald Welte <laforge@gnumonks.org> + */ + +#include <stdio.h> + +#include <gapk/benchmark.h> + +struct benchmark_cycles codec_cycles[_CODEC_MAX]; + +void benchmark_dump(void) +{ + int i; + + for (i = 0; i < _CODEC_MAX; i++) { + struct benchmark_cycles *bc = &codec_cycles[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]; + + printf("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]; + + printf("Codec %u (DEC): %llu cycles for %u frames => " + "%llu cycles/frame\n", i, total, bc->dec_used, + total / bc->dec_used); + } + } +} |