Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2010 22:42:49 +0200
From:      Giovanni Trematerra <gianni@freebsd.org>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   kernel micro-benchmarking framework
Message-ID:  <AANLkTi=Dbam8bCm%2Bi2iv2tkxv5PaHheFUwt=aGV4SnLd@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=Dbam8bCm%2Bi2iv2tkxv5PaHheFUwt=aGV4SnLd>