From 91bd49848faba5040769070fe4ce02133dde7cfe Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Wed, 27 May 2020 21:59:34 +0000 Subject: [PATCH] Build benchmarks again --- bench/meson.build | 20 ++++++++++++++++++++ bench/zrle-bench.c | 14 +++++++------- meson.build | 4 ++++ meson_options.txt | 1 + src/pngfb.c | 2 ++ 5 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 bench/meson.build diff --git a/bench/meson.build b/bench/meson.build new file mode 100644 index 0000000..540cfb7 --- /dev/null +++ b/bench/meson.build @@ -0,0 +1,20 @@ +libpng = dependency('libpng', required: false) + +if libpng.found() + executable( + 'zrle-bench', + [ + 'zrle-bench.c', + '../src/zrle.c', + '../src/pngfb.c', + '../src/pixels.c', + '../src/vec.c', + ], + dependencies: [ + neatvnc_dep, + pixman, + aml, + libpng, + ] + ) +endif diff --git a/bench/zrle-bench.c b/bench/zrle-bench.c index 8e845ed..8048606 100644 --- a/bench/zrle-bench.c +++ b/bench/zrle-bench.c @@ -16,35 +16,35 @@ #include "zrle.h" #include "rfb-proto.h" -#include "util.h" #include "vec.h" #include "neatvnc.h" -#include "miniz.h" +#include "pixels.h" +#include #include #include #include #include #include -uint64_t gettime_us(clockid_t clock) +static uint64_t gettime_us(clockid_t clock) { struct timespec ts = { 0 }; clock_gettime(clock, &ts); return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000ULL; } -#pragma push_options +#pragma GCC push_options #pragma GCC optimize ("-O0") -void memcpy_unoptimized(void* dst, const void* src, size_t len) +static void memcpy_unoptimized(void* dst, const void* src, size_t len) { memcpy(dst, src, len); } -#pragma pop_options +#pragma GCC pop_options struct nvnc_fb* read_png_file(const char *filename); -int run_benchmark(const char *image) +static int run_benchmark(const char *image) { int rc = -1; diff --git a/meson.build b/meson.build index 8c02ef3..72bc7b1 100644 --- a/meson.build +++ b/meson.build @@ -109,6 +109,10 @@ if get_option('examples') subdir('examples') endif +if get_option('benchmarks') + subdir('bench') +endif + install_headers('include/neatvnc.h') pkgconfig = import('pkgconfig') diff --git a/meson_options.txt b/meson_options.txt index d42fcdc..1c2eff6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ +option('benchmarks', type: 'boolean', value: false, description: 'Build benchmarks') option('examples', type: 'boolean', value: false, description: 'Build examples') option('tight-encoding', type: 'feature', value: 'auto', description: 'Enable Tight encoding') option('tls', type: 'feature', value: 'auto', description: 'Enable encryption & authentication') diff --git a/src/pngfb.c b/src/pngfb.c index 1ab0138..4661c79 100644 --- a/src/pngfb.c +++ b/src/pngfb.c @@ -12,6 +12,8 @@ #include #include +struct nvnc_fb* read_png_file(const char* filename); + struct nvnc_fb* read_png_file(const char* filename) { int width, height;