kernel micro-benchmarking framework

From: Giovanni Trematerra <gianni_at_freebsd.org>
Date: Tue, 28 Sep 2010 22:42:49 +0200
Hi all,
based on a work of rwatson_at_ 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
Received on Tue Sep 28 2010 - 19:14:03 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC