Steven Rostedt (Google)
80a76994b2
tracing: Add "fields" option to show raw trace event fields
The hex, raw and bin formats come from the old PREEMPT_RT patch set
latency tracer. That actually gave real alternatives to reading the ascii
buffer. But they have started to bit rot and they do not give a good
representation of the tracing data.
Add "fields" option that will read the trace event fields and parse the
data from how the fields are defined:
With "fields" = 0 (default)
echo 1 > events/sched/sched_switch/enable
cat trace
<idle>-0 [003] d..2. 540.078653: sched_switch: prev_comm=swapper/3 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=kworker/3:1 next_pid=83 next_prio=120
kworker/3:1-83 [003] d..2. 540.078860: sched_switch: prev_comm=kworker/3:1 prev_pid=83 prev_prio=120 prev_state=I ==> next_comm=swapper/3 next_pid=0 next_prio=120
<idle>-0 [003] d..2. 540.206423: sched_switch: prev_comm=swapper/3 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=sshd next_pid=807 next_prio=120
sshd-807 [003] d..2. 540.206531: sched_switch: prev_comm=sshd prev_pid=807 prev_prio=120 prev_state=S ==> next_comm=swapper/3 next_pid=0 next_prio=120
<idle>-0 [001] d..2. 540.206597: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=kworker/u16:4 next_pid=58 next_prio=120
kworker/u16:4-58 [001] d..2. 540.206617: sched_switch: prev_comm=kworker/u16:4 prev_pid=58 prev_prio=120 prev_state=I ==> next_comm=bash next_pid=830 next_prio=120
bash-830 [001] d..2. 540.206678: sched_switch: prev_comm=bash prev_pid=830 prev_prio=120 prev_state=R ==> next_comm=kworker/u16:4 next_pid=58 next_prio=120
kworker/u16:4-58 [001] d..2. 540.206696: sched_switch: prev_comm=kworker/u16:4 prev_pid=58 prev_prio=120 prev_state=I ==> next_comm=bash next_pid=830 next_prio=120
bash-830 [001] d..2. 540.206713: sched_switch: prev_comm=bash prev_pid=830 prev_prio=120 prev_state=R ==> next_comm=kworker/u16:4 next_pid=58 next_prio=120
echo 1 > options/fields
<...>-998 [002] d..2. 538.643732: sched_switch: next_prio=0x78 (120) next_pid=0x0 (0) next_comm=swapper/2 prev_state=0x20 (32) prev_prio=0x78 (120) prev_pid=0x3e6 (998) prev_comm=trace-cmd
<idle>-0 [001] d..2. 538.643806: sched_switch: next_prio=0x78 (120) next_pid=0x33e (830) next_comm=bash prev_state=0x0 (0) prev_prio=0x78 (120) prev_pid=0x0 (0) prev_comm=swapper/1
bash-830 [001] d..2. 538.644106: sched_switch: next_prio=0x78 (120) next_pid=0x3a (58) next_comm=kworker/u16:4 prev_state=0x0 (0) prev_prio=0x78 (120) prev_pid=0x33e (830) prev_comm=bash
kworker/u16:4-58 [001] d..2. 538.644130: sched_switch: next_prio=0x78 (120) next_pid=0x33e (830) next_comm=bash prev_state=0x80 (128) prev_prio=0x78 (120) prev_pid=0x3a (58) prev_comm=kworker/u16:4
bash-830 [001] d..2. 538.644180: sched_switch: next_prio=0x78 (120) next_pid=0x3a (58) next_comm=kworker/u16:4 prev_state=0x0 (0) prev_prio=0x78 (120) prev_pid=0x33e (830) prev_comm=bash
kworker/u16:4-58 [001] d..2. 538.644185: sched_switch: next_prio=0x78 (120) next_pid=0x33e (830) next_comm=bash prev_state=0x80 (128) prev_prio=0x78 (120) prev_pid=0x3a (58) prev_comm=kworker/u16:4
bash-830 [001] d..2. 538.644204: sched_switch: next_prio=0x78 (120) next_pid=0x0 (0) next_comm=swapper/1 prev_state=0x1 (1) prev_prio=0x78 (120) prev_pid=0x33e (830) prev_comm=bash
<idle>-0 [003] d..2. 538.644211: sched_switch: next_prio=0x78 (120) next_pid=0x327 (807) next_comm=sshd prev_state=0x0 (0) prev_prio=0x78 (120) prev_pid=0x0 (0) prev_comm=swapper/3
sshd-807 [003] d..2. 538.644340: sched_switch: next_prio=0x78 (120) next_pid=0x0 (0) next_comm=swapper/3 prev_state=0x1 (1) prev_prio=0x78 (120) prev_pid=0x327 (807) prev_comm=sshd
It traces the data safely without using the trace print formatting.
Link: https://lore.kernel.org/linux-trace-kernel/20230328145156.497651be@gandalf.local.home
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2023-03-29 06:52:08 -04:00
..
2023-01-25 10:31:02 -05:00
2023-02-21 09:23:22 -07:00
2023-03-28 18:52:22 -04:00
2022-06-03 14:05:34 -07:00
2023-03-28 18:52:22 -04:00
2023-03-21 14:00:10 -04:00
2023-03-21 13:43:32 -04:00
2023-03-19 12:20:48 -04:00
2022-07-30 14:01:28 -04:00
2022-04-26 17:58:50 -04:00
2021-10-05 17:38:45 -04:00
2022-11-18 10:15:34 +09:00
2022-11-23 19:08:30 -05:00
2023-03-21 13:59:48 -04:00
2023-02-18 14:34:09 -05:00
2022-09-26 13:01:09 -04:00
2022-09-26 13:01:09 -04:00
2022-05-26 21:13:00 -04:00
2021-06-18 09:10:00 -04:00
2022-11-23 19:07:12 -05:00
2021-08-18 18:10:32 -04:00
2021-06-25 19:57:24 -04:00
2023-02-24 10:04:13 +09:00
2022-11-23 19:08:31 -05:00
2023-01-25 10:31:11 -05:00
2023-03-09 22:17:06 -05:00
2021-12-06 15:37:21 -05:00
2023-02-25 13:06:28 -08:00
2022-12-14 08:50:56 -05:00
2022-12-15 18:01:16 -08:00
2023-02-23 10:20:49 -08:00
2023-02-12 10:23:39 -05:00
2021-10-13 18:19:41 -04:00
2021-10-27 11:21:49 -04:00
2023-03-19 13:23:22 -04:00
2021-07-27 17:05:06 +01:00
2023-02-24 10:04:13 +09:00
2023-03-19 12:20:48 -04:00
2023-03-29 06:52:08 -04:00
2023-03-29 06:52:08 -04:00
2023-01-31 15:01:46 +01:00
2021-10-08 18:08:43 -04:00
2023-02-24 09:44:27 +09:00
2023-02-24 10:04:13 +09:00
2023-02-24 09:44:15 +09:00
2023-02-24 09:44:15 +09:00
2022-05-26 21:12:52 -04:00
2022-05-12 00:37:11 +02:00
2022-05-12 00:37:11 +02:00
2023-03-21 13:59:29 -04:00
2023-02-07 12:42:54 -05:00
2021-10-08 18:08:43 -04:00
2021-10-08 18:08:43 -04:00
2023-01-25 10:31:24 -05:00
2022-11-17 20:21:06 -05:00
2023-02-24 10:04:13 +09:00
2023-03-29 06:52:08 -04:00
2023-03-29 06:52:08 -04:00
2022-10-03 12:20:31 -04:00