aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-04 03:03:32 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-09-04 04:37:21 +0700
commit36e92c49c510711bd7e88beb2935a2a298def9fe (patch)
treec3e395cd30a1787aad9adb1bd65c4557f021a084
parent43f74129c6ed128de8235aed1ce7d0f285193206 (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.
-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)