内核文档“跟踪:跟踪事件触发器”说,只要触发事件被触发,我就可以使用 stacktrace cmd 将堆栈跟踪转储到跟踪缓冲区。但我得到的只是一个简单的字符串“stacktrace”。这是我的配置:
cd /sys/kernel/debug/tracing/events/sched/sched_switch
回声 1 > 启用
回声“堆栈跟踪”> 触发器
猫触发器
堆栈跟踪:无限
当我查看“跟踪”输出时,我看到的是:
kworker/u2:0-4002 [000] d... 1275475.478000: sched_switch: prev_comm=kworker/u2:0 prev_pid=4002 prev_prio=120 prev_state=S ==> next_comm=sshd next_pid=3048 next_prio=120
kworker/u2:0-4002 [000] d... 1275475.478000: <stack trace>
sshd-3048 [000] d... 1275475.478000: sched_switch: prev_comm=sshd prev_pid=3048 prev_prio=120 prev_state=S ==> next_comm=vim next_pid=4059 next_prio=120
sshd-3048 [000] d... 1275475.478000: <stack trace>
vim-4059 [000] d... 1275475.479000: sched_switch: prev_comm=vim prev_pid=4059 prev_prio=120 prev_state=R ==> next_comm=rcu_sched next_pid=8 next_prio=120
vim-4059 [000] d... 1275475.479000: <stack trace>
rcu_sched-8 [000] d... 1275475.479000: sched_switch: prev_comm=rcu_sched prev_pid=8 prev_prio=120 prev_state=S ==> next_comm=vim next_pid=4059 next_prio=120
rcu_sched-8 [000] d... 1275475.479000: <stack trace>
vim-4059 [000] d... 1275475.481000: sched_switch: prev_comm=vim prev_pid=4059 prev_prio=120 prev_state=R ==> next_comm=rcu_sched next_pid=8 next_prio=120
vim-4059 [000] d... 1275475.481000: <stack trace>
rcu_sched-8 [000] d... 1275475.481000: sched_switch: prev_comm=rcu_sched prev_pid=8 prev_prio=120 prev_state=S ==> next_comm=vim next_pid=4059 next_prio=120
rcu_sched-8 [000] d... 1275475.481000: <stack trace>
vim-4059 [000] d... 1275475.482000: sched_switch: prev_comm=vim prev_pid=4059 prev_prio=120 prev_state=R ==> next_comm=rcu_sched next_pid=8 next_prio=120
vim-4059 [000] d... 1275475.482000: <stack trace>
rcu_sched-8 [000] d... 1275475.482000: sched_switch: prev_comm=rcu_sched prev_pid=8 prev_prio=120 prev_state=S ==> next_comm=vim next_pid=4059 next_prio=120
rcu_sched-8 [000] d... 1275475.482000: <stack trace>
vim-4059 [000] d... 1275475.483000: sched_switch: prev_comm=vim prev_pid=4059 prev_prio=120 prev_state=R+ ==> next_comm=rcu_sched next_pid=8 next_prio=120
vim-4059 [000] d... 1275475.483000: <stack trace>
rcu_sched-8 [000] d... 1275475.483000: sched_switch: prev_comm=rcu_sched prev_pid=8 prev_prio=120 prev_state=S ==> next_comm=ksoftirqd/0 next_pid=7 next_prio=120
rcu_sched-8 [000] d... 1275475.483000: <stack trace>
ksoftirqd/0-7 [000] d... 1275475.483000: sched_switch: prev_comm=ksoftirqd/0 prev_pid=7 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=8 next_prio=120
ksoftirqd/0-7 [000] d... 1275475.483000: <stack trace>
rcu_sched-8 [000] d... 1275475.483000: sched_switch: prev_comm=rcu_sched prev_pid=8 prev_prio=120 prev_state=S ==> next_comm=vim next_pid=4059 next_prio=120
rcu_sched-8 [000] d... 1275475.483000: <stack trace>
如何使堆栈跟踪转储所有堆栈跟踪。