ring-buffer: change test to be more latency friendly
authorSteven Rostedt <srostedt@redhat.com>
Wed, 6 May 2009 22:36:59 +0000 (18:36 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 6 May 2009 22:36:59 +0000 (18:36 -0400)
commit3e07a4f680adc66dfa175aa5021aedf340251b12
treec245b416cf3d88e4c2f1d0ff43d0021e59b20b47
parent6634ff26cce2da04e5c2a5481bcb8888e7d01786
ring-buffer: change test to be more latency friendly

The ring buffer benchmark/test runs a producer for 10 seconds.
This is done with preemption and interrupts enabled. But if the kernel
is not compiled with CONFIG_PREEMPT, it basically stops everything
but interrupts for 10 seconds.

Although this is just a test and is not for production, this attribute
can be quite annoying. It can also spawn badness elsewhere.

This patch solves the issues by calling "cond_resched" when the system
is not compiled with CONFIG_PREEMPT. It also keeps track of the time
spent to call cond_resched such that it does not go against the
time calculations. That is, if the task schedules away, the time scheduled
out is removed from the test data. Note, this only works for non PREEMPT
because we do not know when the task is scheduled out if we have PREEMPT
enabled.

[ Impact: prevent test from stopping the world for 10 seconds ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ring_buffer_benchmark.c