From 7a04624563ac72b7237e39d6fcee5dab96f4d948 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 8 May 2014 19:18:01 +0200 Subject: 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. --- src/codec_hr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/codec_hr.c') 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 +#include #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 */ -- cgit v1.2.3