aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-04 03:03:32 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commitc9a75e59c67d62bc9d64c8c110ef47feb60e7ebf (patch)
tree6dfddd31cc8a8d4859c1f451be796e29fdfeaaf9 /include
parentba46856bb403a507977e4c699c90714c962463f9 (diff)
benchmark: get rid of 'static inline' definition
The usage of a 'static inline' function definition in the 'bench.h' is resulting in separate independent function definitions in each translation unit from which the header is included. This is increasing the size of compiled code unnecessarily.
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gapk/bench.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/include/osmocom/gapk/bench.h b/include/osmocom/gapk/bench.h
index 02c28db..1cfbeb3 100644
--- a/include/osmocom/gapk/bench.h
+++ b/include/osmocom/gapk/bench.h
@@ -24,27 +24,25 @@
#include <osmocom/gapk/benchmark.h>
#include <osmocom/gapk/codecs.h>
-static inline void benchmark_store(enum osmo_gapk_codec_type codec,
- int encode, unsigned long cycles)
-{
- struct osmo_gapk_bench_cycles *bc = &osmo_gapk_bench_codec[codec];
-
- if (encode) {
- bc->enc_used = (bc->enc_used + 1) % OSMO_GAPK_CYCLES_NUM_AVG;
- bc->enc[bc->enc_used] = cycles;
- } else {
- bc->dec_used = (bc->dec_used + 1) % OSMO_GAPK_CYCLES_NUM_AVG;
- bc->dec[bc->dec_used] = cycles;
- }
-}
-
#define BENCHMARK_START \
do { \
cycles_t _cycles_start, _cycles_stop; \
+ struct osmo_gapk_bench_cycles *_bc; \
_cycles_start = get_cycles()
-#define BENCHMARK_STOP(codec, enc) \
- _cycles_stop = get_cycles(); \
- benchmark_store(codec, enc, \
- _cycles_stop - _cycles_start); \
+#define BENCHMARK_STOP(codec, encode) \
+ _cycles_stop = get_cycles(); \
+ _bc = &osmo_gapk_bench_codec[codec]; \
+ \
+ if (encode) { \
+ _bc->enc_used = (_bc->enc_used + 1) \
+ % OSMO_GAPK_CYCLES_NUM_AVG; \
+ _bc->enc[_bc->enc_used] = \
+ _cycles_stop - _cycles_start; \
+ } else { \
+ _bc->dec_used = (_bc->dec_used + 1) \
+ % OSMO_GAPK_CYCLES_NUM_AVG; \
+ _bc->dec[_bc->dec_used] = \
+ _cycles_stop - _cycles_start; \
+ } \
} while (0)