diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-05-07 14:20:28 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-05-07 14:20:28 -0400 |
commit | 0574ea421b90e0e45a72c447dd3c2c79ffd8c153 (patch) | |
tree | ec19f007794a8593f1c75f3f2d05c2471346298e /kernel/trace/ring_buffer_benchmark.c | |
parent | 65b77242043f74bca6a0d733c0e48ef03a8c9893 (diff) |
ring-buffer: only periodically call cond_resched to ring-buffer-benchmark
Calling cond_resched at every iteration of the loop adds a bit of
overhead to the benchmark.
This patch does two things.
1) only calls cond-resched when CONFIG_PREEMPT is not enabled
2) only calls cond-resched after so many traces has been performed.
[ Impact: less overhead to the ring-buffer-benchmark ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer_benchmark.c')
-rw-r--r-- | kernel/trace/ring_buffer_benchmark.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c index f4ceb453c7dd..a7c048bb4466 100644 --- a/kernel/trace/ring_buffer_benchmark.c +++ b/kernel/trace/ring_buffer_benchmark.c | |||
@@ -218,16 +218,23 @@ static void ring_buffer_producer(void) | |||
218 | } | 218 | } |
219 | do_gettimeofday(&end_tv); | 219 | do_gettimeofday(&end_tv); |
220 | 220 | ||
221 | if (consumer && !(++cnt % wakeup_interval)) | 221 | cnt++; |
222 | if (consumer && !(cnt % wakeup_interval)) | ||
222 | wake_up_process(consumer); | 223 | wake_up_process(consumer); |
223 | 224 | ||
225 | #ifndef CONFIG_PREEMPT | ||
224 | /* | 226 | /* |
225 | * If we are a non preempt kernel, the 10 second run will | 227 | * If we are a non preempt kernel, the 10 second run will |
226 | * stop everything while it runs. Instead, we will call | 228 | * stop everything while it runs. Instead, we will call |
227 | * cond_resched and also add any time that was lost by a | 229 | * cond_resched and also add any time that was lost by a |
228 | * rescedule. | 230 | * rescedule. |
231 | * | ||
232 | * Do a cond resched at the same frequency we would wake up | ||
233 | * the reader. | ||
229 | */ | 234 | */ |
230 | cond_resched(); | 235 | if (cnt % wakeup_interval) |
236 | cond_resched(); | ||
237 | #endif | ||
231 | 238 | ||
232 | } while (end_tv.tv_sec < (start_tv.tv_sec + RUN_TIME) && !kill_test); | 239 | } while (end_tv.tv_sec < (start_tv.tv_sec + RUN_TIME) && !kill_test); |
233 | pr_info("End ring buffer hammer\n"); | 240 | pr_info("End ring buffer hammer\n"); |