User Tools

Site Tools


realtime:documentation:howto:tools:cyclictest:tracing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
realtime:documentation:howto:tools:cyclictest:tracing [2018/08/22 10:21]
ebugden [Measuring the Tracing Overhead] Improve phrasing
realtime:documentation:howto:tools:cyclictest:tracing [2022/01/19 20:01] (current)
bartwensley [Producing a Trace] Removed --ftrace option which has not been supported since rt-tests version 1.4.
Line 1: Line 1:
 ====== Cyclictest - Latency debugging with tracing ====== ====== Cyclictest - Latency debugging with tracing ======
  
-Tracing is useful when trying to determine the cause of a latency because it can reveal relevant details about execution. There are several options in Cyclictest that can be used to produce ​traces ​via Ftrace.+Tracing is useful when trying to determine the cause of a latency because it can reveal relevant details about execution. There are several options in Cyclictest that can be used to capture ​traces ​in combination with Ftrace.
  
-===== Break Trace Option =====+Information about how to set up Ftrace as well as how to view traces taken with Ftrace can be found [[realtime:​documentation:​howto:​tools:​ftrace|here]].
  
-A trace can be collected through Cyclictest by using the break trace (--breaktrace) option together with one of the tracing options. The break trace option will stop tracing and end Cyclictest if it detects a latency that is longer than a specified limit. This option is intended to be used with the Cyclictest options that enable Ftrace instrumentation (e.g. --irqsoff).+---- 
 + 
 +===== Break Trace Option =====
  
-<WRAP center round info 60%> +A trace can be collected through Cyclictest by using the break trace (--breaktrace) ​option ​together with the --tracemark ​option. These options ​will stop tracing ​and end Cyclictest if it detects a latency ​that is longer than a specified limit. The ftrace must be started ​before Cyclictest ​is executed.
-Ftrace might not behave the same way after using the break trace option. When the break trace option ​is used, Cyclictest changes some Ftrace ​options ​to get the desired trace format, such as specifying print-parent ​and latency-format. The Ftrace options that were set before ​are not restored after Cyclictest ​runs. +
-</​WRAP>​+
  
 ===== Selecting Instrumentation ===== ===== Selecting Instrumentation =====
  
-Cyclictest offers ​number options which use different Ftrace ​tracers and instrumentation. These options are described in the Cyclictest help text (--help) and on the man page. The most important things to keep in mind when choosing instrumentation are the trace detail and the resulting overhead. A trace with more detail will require a higher overhead. In general, it is effective to corner the source of the latency over several iterations of tracing and analysis while gradually increasing the trace detail. Start with a small amount of instrumentation,​ which produces a simple trace. One good option would be to start by eliminating the most obvious possible sources of latency by tracing when interrupts or preemption are disabled.+Ftrace provides ​selection of tracers and instrumentation. These options are described in the Ftrace documentation [[realtime:​documentation:​howto:​tools:​ftrace|here]]. The most important things to keep in mind when choosing instrumentation are the trace detail and the resulting overhead. A trace with more detail will require a higher overhead. In general, it is effective to corner the source of the latency over several iterations of tracing and analysis while gradually increasing the trace detail. Start with a small amount of instrumentation,​ which produces a simple trace. One good option would be to start by eliminating the most obvious possible sources of latency by tracing when interrupts or preemption are disabled.
  
 ==== Function Tracing ==== ==== Function Tracing ====
Line 39: Line 39:
 </​code>​ </​code>​
  
-and after a couple hours a maximum latency of 130 us is detected. To measure the value of the maximum latency with the overhead from function tracing, the following Cyclictest command could be run:+and after a couple hours a maximum latency of 130 us is detected. To measure the value of the maximum latency with the overhead from function tracing, ​ftrace can be enabled and then the following Cyclictest command could be run:
  
 <code bash> <code bash>
-cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 --breaktrace=2000 --ftrace+cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 --breaktrace=2000 --tracemark
 </​code>​ </​code>​
  
Line 51: Line 51:
 ==== Producing a Trace ==== ==== Producing a Trace ====
  
-Finally, a trace that includes the latency can be produced by running Cyclictest with a break trace limit that is slightly below the maximum latency value that was observed with tracing enabled. Continuing the example from the previous section, if the maximum latency with the overhead from function tracing is 190 us then the following command could be used to produce the trace:+Finally, a trace that includes the latency can be produced by starting ftrace and then running Cyclictest with a break trace limit that is slightly below the maximum latency value that was observed with tracing enabled. Continuing the example from the previous section, if the maximum latency with the overhead from function tracing is 190 us then the following command could be used to produce the trace:
  
 <code bash> <code bash>
-cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 --breaktrace=180 --ftrace+cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 --breaktrace=180 --tracemark
 </​code>​ </​code>​
  
 using a break trace limit of 180 us. This new limit will cause Cyclictest to stop when the maximum latency occurs and will produce the relevant trace. This trace can then be viewed via tracefs in the same way as other Ftrace traces. using a break trace limit of 180 us. This new limit will cause Cyclictest to stop when the maximum latency occurs and will produce the relevant trace. This trace can then be viewed via tracefs in the same way as other Ftrace traces.
realtime/documentation/howto/tools/cyclictest/tracing.1534933267.txt.gz · Last modified: 2018/08/22 10:21 by ebugden