Re: [PATCH][RFC] Adding hackbench.c to tools/

From: Ingo Molnar
Date: Mon Nov 02 2009 - 05:41:53 EST

* Hitoshi Mitake <mitake@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Ingo,
> It seems that hackbench is the de-fact standard benchmarking program
> for scheduler of Linux. But when I ask google where hackbench.c is,
> some answers are replied. Like these, (in order of google result)
> (this page
> containts link to hackbench.c)
> And it seems that second one is newer.
> I think this situation is very confusable. So I wrote this patch to
> add hackbench to tools/ of kernel tree. This may help hackbench users
> like me.

I think we can do something nicer: would you be interested in adding it
as a 'perf bench hackbench' sub-command of tools/perf/?

We already have the tools to measure scheduling behavior under 'perf
sched', so having a 'perf bench' array of common tests would be nice to

( I've Cc:-ed Rusty, the original author of hackbench.c. Rusty, the file
has no explicit GPLv2 compatible license - is it fine to be put
into GPLv2 code? )

Adding a new perf sub-command is easy:

create a new tools/perf/builtin-bench.c file and copy hackbench.c to it,
add it to command-list.txt and to the Makefile - add it to perf.c's
array of built-in commands and [optional] add a
Documentation/perf-bench.txt file to generate manpages and usage strings
for it.

Change the 'main' function to cmd_bench() and add option parsing like
you can see in the other builtin-*.c files. This should get you going.

Eventually we'd add more scheduler (and other) benchmarks too, not just
hackbench. I'd also suggest to name it not 'hackbench' but something
more generic, like:

perf bench sched messaging

So that we can have subsystem identifier first, then the type of

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at