]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - kernel/trace/ring_buffer_benchmark.c
ring-buffer: add benchmark and tester
authorSteven Rostedt <srostedt@redhat.com>
Wed, 6 May 2009 02:47:18 +0000 (22:47 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 6 May 2009 04:08:50 +0000 (00:08 -0400)
commit5092dbc96f3acdac5433b27c06860352dc6d23b9
tree641b6b25439bf879769e20b4dc0f0bc9a6e6d702
parentaa20ae8444fc6c318272c643f856d8d8ad3e198d
ring-buffer: add benchmark and tester

This patch adds code that can benchmark the ring buffer as well as
test it. This code can be compiled into the kernel (not recommended)
or as a module.

A separate ring buffer is used to not interfer with other users, like
ftrace. It creates a producer and a consumer (option to disable creation
of the consumer) and will run for 10 seconds, then sleep for 10 seconds
and then repeat.

While running, the producer will write 10 byte loads into the ring
buffer with just putting in the current CPU number. The reader will
continually try to read the buffer. The reader will alternate from reading
the buffer via event by event, or by full pages.

The output is a pr_info, thus it will fill up the syslogs.

  Starting ring buffer hammer
  End ring buffer hammer
  Time:     9000349 (usecs)
  Overruns: 12578640
  Read:     5358440  (by events)
  Entries:  0
  Total:    17937080
  Missed:   0
  Hit:      17937080
  Entries per millisec: 1993
  501 ns per entry
  Sleeping for 10 secs
  Starting ring buffer hammer
  End ring buffer hammer
  Time:     9936350 (usecs)
  Overruns: 0
  Read:     28146644  (by pages)
  Entries:  74
  Total:    28146718
  Missed:   0
  Hit:      28146718
  Entries per millisec: 2832
  353 ns per entry
  Sleeping for 10 secs

Time:      is the time the test ran
Overruns:  the number of events that were overwritten and not read
Read:      the number of events read (either by pages or events)
Entries:   the number of entries left in the buffer
                 (the by pages will only read full pages)
Total:     Entries + Read + Overruns
Missed:    the number of entries that failed to write
Hit:       the number of entries that were written

The above example shows that it takes ~353 nanosecs per entry when
there is a reader, reading by pages (and no overruns)

The event by event reader slowed the producer down to 501 nanosecs.

[ Impact: see how changes to the ring buffer affect stability and performance ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/Kconfig
kernel/trace/Makefile
kernel/trace/ring_buffer_benchmark.c [new file with mode: 0644]