From: Maxim Baryshnikov Date: Fri, 6 May 2016 02:53:35 +0000 (+0200) Subject: l4: Try to implement benchmark pkg. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/l4.git/commitdiff_plain/6872a213ac58ef264825dc92aff484df59041065?hp=8c3e8038fdaee9c87eb5e17d775e98a63fd5cf76 l4: Try to implement benchmark pkg. --- diff --git a/l4/pkg/benchmark/Control b/l4/pkg/benchmark/Control new file mode 100644 index 000000000..632074ffa --- /dev/null +++ b/l4/pkg/benchmark/Control @@ -0,0 +1,2 @@ +requires: stdlibs +Maintainer: adam@os.inf.tu-dresden.de diff --git a/l4/pkg/benchmark/Makefile b/l4/pkg/benchmark/Makefile new file mode 100644 index 000000000..f8ca7cc29 --- /dev/null +++ b/l4/pkg/benchmark/Makefile @@ -0,0 +1,4 @@ +PKGDIR = . +L4DIR ?= $(PKGDIR)/../.. + +include $(L4DIR)/mk/subdir.mk diff --git a/l4/pkg/benchmark/README b/l4/pkg/benchmark/README new file mode 100644 index 000000000..3e44ff4c7 --- /dev/null +++ b/l4/pkg/benchmark/README @@ -0,0 +1 @@ +Simple Hello Example. diff --git a/l4/pkg/benchmark/server/Makefile b/l4/pkg/benchmark/server/Makefile new file mode 100644 index 000000000..04ac0da07 --- /dev/null +++ b/l4/pkg/benchmark/server/Makefile @@ -0,0 +1,4 @@ +PKGDIR ?= .. +L4DIR ?= $(PKGDIR)/../.. + +include $(L4DIR)/mk/subdir.mk diff --git a/l4/pkg/benchmark/server/src/Makefile b/l4/pkg/benchmark/server/src/Makefile new file mode 100644 index 000000000..45ae57d31 --- /dev/null +++ b/l4/pkg/benchmark/server/src/Makefile @@ -0,0 +1,7 @@ +PKGDIR ?= ../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = benchmark +SRC_C = main.c + +include $(L4DIR)/mk/prog.mk diff --git a/l4/pkg/benchmark/server/src/main.c b/l4/pkg/benchmark/server/src/main.c new file mode 100644 index 000000000..4181d76ed --- /dev/null +++ b/l4/pkg/benchmark/server/src/main.c @@ -0,0 +1,103 @@ +//taken from [..see below..] and modifed a little. +/* + * lib_mem.c - library of routines used to analyze the memory hierarchy + * + * @(#)lib_mem.c 1.15 staelin@hpliclu2.hpli.hpl.hp.com + * + * Copyright (c) 2000 Carl Staelin. + * Copyright (c) 1994 Larry McVoy. + * Distributed under the FSF GPL with + * additional restriction that results may published only if + * (1) the benchmark is unmodified, and + * (2) the version in the sccsid below is included in the report. + * Support for this development by Sun Microsystems is gratefully acknowledged. + */ + +#include +#include +#include + +#include +#include + +void use_dummy(int result); +size_t* words_initialize(size_t max, int scale); +l4_uint64_t parse_param( char param, int argc, char* argv[]); + +static volatile l4_uint64_t use_result_dummy; +void use_dummy(int result) { use_result_dummy += result; } + +/* + * words_initialize + * + * This is supposed to create the order in which the words in a + * "cache line" are used. Since we rarely know the cache line + * size with any real reliability, we need to jump around so + * as to maximize the number of potential cache misses, and to + * minimize the possibility of re-using a cache line. + */ +size_t* words_initialize(size_t max, int scale) +{ + size_t i, j, nbits; + size_t* words = (size_t*)calloc(max, sizeof(size_t)); + + if (!words) return NULL; + + //bzero(words, max * sizeof(size_t)); + for (i = max>>1, nbits = 0; i != 0; i >>= 1, nbits++) + ; + for (i = 0; i < max; ++i) { + /* now reverse the bits */ + for (j = 0; j < nbits; j++) { + if (i & (1<