aboutsummaryrefslogtreecommitdiffstats
path: root/src/codec_fr.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_fr.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_fr.c')
-rw-r--r--src/codec_fr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codec_fr.c b/src/codec_fr.c
index 3b1bb7c..1bda210 100644
--- a/src/codec_fr.c
+++ b/src/codec_fr.c
@@ -18,6 +18,7 @@
*/
#include <gapk/codecs.h>
+#include <gapk/benchmark.h>
#include "config.h"
@@ -54,7 +55,9 @@ codec_fr_encode(void *state, uint8_t *cod, const uint8_t *pcm)
gsm gh = (gsm)state;
uint8_t pcm_b[2*160]; /* local copy as libgsm src isn't const ! */
memcpy(pcm_b, pcm, 2*160);
+ BENCHMARK_START;
gsm_encode(gh, (gsm_signal*)pcm, (gsm_byte*)cod);
+ BENCHMARK_STOP(CODEC_FR, 1);
return 0;
}
@@ -63,8 +66,12 @@ codec_fr_decode(void *state, uint8_t *pcm, const uint8_t *cod)
{
gsm gh = (gsm)state;
uint8_t cod_b[33]; /* local copy as libgsm src isn't const ! */
+ int rc;
memcpy(cod_b, cod, 33);
- return gsm_decode(gh, (gsm_byte*)cod_b, (gsm_signal*)pcm);
+ BENCHMARK_START;
+ rc = gsm_decode(gh, (gsm_byte*)cod_b, (gsm_signal*)pcm);
+ BENCHMARK_STOP(CODEC_FR, 1);
+ return rc;
}
#endif /* HAVE_LIBGSM */