Build benchmarks again

pull/42/head
Andri Yngvason 2020-05-27 21:59:34 +00:00
parent d2527e57f0
commit 91bd49848f
5 changed files with 34 additions and 7 deletions

20
bench/meson.build 100644
View File

@ -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

View File

@ -16,35 +16,35 @@
#include "zrle.h" #include "zrle.h"
#include "rfb-proto.h" #include "rfb-proto.h"
#include "util.h"
#include "vec.h" #include "vec.h"
#include "neatvnc.h" #include "neatvnc.h"
#include "miniz.h" #include "pixels.h"
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <libdrm/drm_fourcc.h> #include <libdrm/drm_fourcc.h>
#include <pixman.h> #include <pixman.h>
#include <time.h> #include <time.h>
#include <inttypes.h> #include <inttypes.h>
uint64_t gettime_us(clockid_t clock) static uint64_t gettime_us(clockid_t clock)
{ {
struct timespec ts = { 0 }; struct timespec ts = { 0 };
clock_gettime(clock, &ts); clock_gettime(clock, &ts);
return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000ULL; return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000ULL;
} }
#pragma push_options #pragma GCC push_options
#pragma GCC optimize ("-O0") #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); memcpy(dst, src, len);
} }
#pragma pop_options #pragma GCC pop_options
struct nvnc_fb* read_png_file(const char *filename); 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; int rc = -1;

View File

@ -109,6 +109,10 @@ if get_option('examples')
subdir('examples') subdir('examples')
endif endif
if get_option('benchmarks')
subdir('bench')
endif
install_headers('include/neatvnc.h') install_headers('include/neatvnc.h')
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')

View File

@ -1,3 +1,4 @@
option('benchmarks', type: 'boolean', value: false, description: 'Build benchmarks')
option('examples', type: 'boolean', value: false, description: 'Build examples') option('examples', type: 'boolean', value: false, description: 'Build examples')
option('tight-encoding', type: 'feature', value: 'auto', description: 'Enable Tight encoding') option('tight-encoding', type: 'feature', value: 'auto', description: 'Enable Tight encoding')
option('tls', type: 'feature', value: 'auto', description: 'Enable encryption & authentication') option('tls', type: 'feature', value: 'auto', description: 'Enable encryption & authentication')

View File

@ -12,6 +12,8 @@
#include <assert.h> #include <assert.h>
#include <libdrm/drm_fourcc.h> #include <libdrm/drm_fourcc.h>
struct nvnc_fb* read_png_file(const char* filename);
struct nvnc_fb* read_png_file(const char* filename) struct nvnc_fb* read_png_file(const char* filename)
{ {
int width, height; int width, height;