]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
tracing: Add config option to allow snapshot to swap per cpu
authorSteven Rostedt (Red Hat) <srostedt@redhat.com>
Tue, 5 Mar 2013 19:50:23 +0000 (14:50 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:35:47 +0000 (00:35 -0400)
When the preempt or irq latency tracers are enabled, they require
the ring buffer to be able to swap the per cpu sub buffers between
two main buffers. This adds a slight overhead to tracing as the
trace recording needs to perform some checks to synchronize
between recording and swaps that might be happening on other CPUs.

The config RING_BUFFER_ALLOW_SWAP is set when a user of the ring
buffer needs the "swap cpu" feature, otherwise the extra checks
are not implemented and removed from the tracing overhead.

The snapshot feature will swap per CPU if the RING_BUFFER_ALLOW_SWAP
config is set. But that only gets set by things like OPROFILE
and the irqs and preempt latency tracers.

This config is added to let the user decide to include this feature
with the snapshot agnostic from whether or not another user of
the ring buffer sets this config.

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

index 590a27fc212f99a07ec016c9ead4d3230df11b1c..f78eab25189741b93e31a9821cd1ba0ea991cb3f 100644 (file)
@@ -192,6 +192,7 @@ config IRQSOFF_TRACER
        select TRACER_MAX_TRACE
        select RING_BUFFER_ALLOW_SWAP
        select TRACER_SNAPSHOT
+       select TRACER_SNAPSHOT_PER_CPU_SWAP
        help
          This option measures the time spent in irqs-off critical
          sections, with microsecond accuracy.
@@ -215,6 +216,7 @@ config PREEMPT_TRACER
        select TRACER_MAX_TRACE
        select RING_BUFFER_ALLOW_SWAP
        select TRACER_SNAPSHOT
+       select TRACER_SNAPSHOT_PER_CPU_SWAP
        help
          This option measures the time spent in preemption-off critical
          sections, with microsecond accuracy.
@@ -266,6 +268,27 @@ config TRACER_SNAPSHOT
              echo 1 > /sys/kernel/debug/tracing/snapshot
              cat snapshot
 
+config TRACER_SNAPSHOT_PER_CPU_SWAP
+        bool "Allow snapshot to swap per CPU"
+       depends on TRACER_SNAPSHOT
+       select RING_BUFFER_ALLOW_SWAP
+       help
+         Allow doing a snapshot of a single CPU buffer instead of a
+         full swap (all buffers). If this is set, then the following is
+         allowed:
+
+             echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
+
+         After which, only the tracing buffer for CPU 2 was swapped with
+         the main tracing buffer, and the other CPU buffers remain the same.
+
+         When this is enabled, this adds a little more overhead to the
+         trace recording, as it needs to add some checks to synchronize
+         recording with swaps. But this does not affect the performance
+         of the overall system. This is enabled by default when the preempt
+         or irq latency tracers are enabled, as those need to swap as well
+         and already adds the overhead (plus a lot more).
+
 config TRACE_BRANCH_PROFILING
        bool
        select GENERIC_TRACER