kernel micro-benchmarking framework
Giovanni Trematerra
gianni at freebsd.org
Tue Sep 28 21:14:03 UTC 2010
Hi all,
based on a work of rwatson@ about micro-benchmarking,
I managed to have a kernel module that exposes some sysctls.
Reading sysctl associated to test start the benchmark and print the results.
The code is split up in this way:
test.h, test.c
where the infrastructure work lives.
test_sync_timing.c
test_mem_timing.c
where the actual micro-benchmarks live:
I wrote some macros to simplify adding more benchmarks. (test.h)
The idea is to have a struct for every benchmark/test
struct timing_proc {
void (*setup)(void *); /* called before
starting timing */
void (*test)(void *); /* what we want
microbenchmark */
void (*tear_down)(void *); /* called after the end of timing */
void *args; /* pointer passed to
the above funcs */
};
and let an agnostic code deals with it.
Every test can specify a setup and tear_down function for
allocate/deallocate resources and a test function to benchmark things.
The great difference with Robert's code is that the test function cannot be
inline as it's a pointer to function. I don't know if that could
influence the results.
The test function is called with interrupt disabled.
We could further extent this framework to add regression test support.
You could get the code here:
http://www.trematerra.net/patches/timing.tbz
Feedback and reviews are welcome.
Thanks
--
Gianni
More information about the freebsd-current
mailing list