summaryrefslogtreecommitdiffstats
path: root/src/codec_hr.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-05-08 19:18:01 +0200
committerHarald Welte <laforge@gnumonks.org>2014-05-08 19:18:01 +0200
commit7a04624563ac72b7237e39d6fcee5dab96f4d948 (patch)
treee97aa7567abe2c3f205c327ff3ef5d5d160fbd2e /src/codec_hr.c
parent8b5e0c7b81cba9f064bed97dc743e5a9a13818f1 (diff)
Add cycle benchmarking support
This enables benchmarking of the codec. It will print the amount of CPU cycles needed for encoding/decoding a single 20ms frame on average.
Diffstat (limited to 'src/codec_hr.c')
-rw-r--r--src/codec_hr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/codec_hr.c b/src/codec_hr.c
index 26a75a5..d0e09ce 100644
--- a/src/codec_hr.c
+++ b/src/codec_hr.c
@@ -18,6 +18,7 @@
*/
#include <gapk/codecs.h>
+#include <gapk/benchmark.h>
#include "config.h"
@@ -43,14 +44,22 @@ static int
codec_hr_encode(void *_state, uint8_t *cod, const uint8_t *pcm)
{
struct gsmhr *state = _state;
- return gsmhr_encode(state, (int16_t *)cod, (const int16_t *)pcm);
+ int rc;
+ BENCHMARK_START;
+ rc = gsmhr_encode(state, (int16_t *)cod, (const int16_t *)pcm);
+ BENCHMARK_STOP(CODEC_HR, 1);
+ return rc;
}
static int
codec_hr_decode(void *_state, uint8_t *pcm, const uint8_t *cod)
{
struct gsmhr *state = _state;
- return gsmhr_decode(state, (int16_t *)pcm, (const int16_t *)cod);
+ int rc;
+ BENCHMARK_START;
+ rc = gsmhr_decode(state, (int16_t *)pcm, (const int16_t *)cod);
+ BENCHMARK_STOP(CODEC_HR, 0);
+ return rc;
}
#endif /* HAVE_LIBGSMHR */