blob: 538d9c9d37d948cf1e1b719fccf4bcbe0bd4348c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
= ftrace =
Trace Compass supports the raw textual format of various ftrace plugins.
== Supported ftrace features ==
=== Event tracing ===
ftrace traces with kernel events are kernel traces and all analyses available with other kernel traces in Trace Compass are made available for those traces: Kernel resources and threads analyses, I/O, memory, critical path, etc.
[[Image:images/kernelAnalyses.png]]
=== function graph ===
The function graph plugin of trace allows to record the function entry and exits of various kernel functions. With this kind of trace, we can obtain a callstack / flame chart / flame graph for the various threads on the machine.
[[Image:images/FuncGraph.png]]
== Generating a trace ==
There are two ways to generate the trace in the human readable raw format. Using ftrace via the debugfs filesystem or using the trace-cmd command-line tool.
=== Debugfs filesystem ===
Mount the debugfs filesystem using the following command:
# mount -t debugfs nodev /sys/kernel/debug
The filesystem could be mounted elsewhere.
Before starting the tracer, traced events must be enabled by echoing ''1'' in the correct files.
For example, enabling ''sched_switch'' and ''sched_wakeup'' is done with the following commands:
# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
Recording of a trace is started by echoing ''1'' in ''tracing_on'':
# echo 1 > /sys/kernel/debug/tracing/tracing_on
Recording is stopped by echoing ''0'' in the same file.
The trace can be obtained in raw format in the ''trace'' file:
# cat /sys/kernel/debug/tracing/trace
=== trace-cmd ===
Recording of a trace can be started by the following command:
# trace-cmd record -e sched_switch -e sched_wakeup
The recorded trace would contain only ''sched_switch'' and ''sched_wakeup'' events. Outputting the recorded trace is done using the following command:
# trace-cmd report -R
The ''-R'' argument is needed to get the raw format.
See the [https://linux.die.net/man/1/trace-cmd trace-cmd documentation] for more tracing options.
|