/usr/share/systemtap/examples/profiling
NameSizeModeActions
container_check.meta10640644editdlrm
container_check.stp63230755editdlrm
errno.meta4560644editdlrm
errno.stp9840755editdlrm
fileline-profile.meta7830644editdlrm
fileline-profile.stp12180755editdlrm
fntimes.meta5120644editdlrm
fntimes.stp8700755editdlrm
fntimes.txt13750644editdlrm
functioncallcount.meta6490644editdlrm
functioncallcount.stp4900755editdlrm
functioncallcount.tcl3990644editdlrm
graphcall.stp5340755editdlrm
ioctl_handler.meta12090644editdlrm
ioctl_handler.stp8110755editdlrm
latencytap.meta8770644editdlrm
latencytap.stp127550755editdlrm
latencytap.tcl1400644editdlrm
latencytap.txt21040644editdlrm
linetimes.meta6880644editdlrm
linetimes.stp16080755editdlrm
linetimes.txt139360644editdlrm
perf.meta5780644editdlrm
perf.stp19360755editdlrm
perf.tcl1660644editdlrm
periodic.meta8950644editdlrm
periodic.stp26590755editdlrm
pf2.meta4200644editdlrm
pf2.stp3700755editdlrm
pf2.txt4060644editdlrm
pf3.meta4390644editdlrm
pf3.stp9920755editdlrm
pf3.txt4890644editdlrm
pf4.meta4710644editdlrm
pf4.stp9520755editdlrm
pf4.tcl790644editdlrm
pf4.txt7540644editdlrm
sched_switch.meta7800644editdlrm
sched_switch.stp21270755editdlrm
syscallerrorsbypid.meta10670644editdlrm
syscallerrorsbypid.stp9500755editdlrm
syscalllatency.meta10720644editdlrm
syscalllatency.stp9890755editdlrm
syscallsbypid.meta10200644editdlrm
syscallsbypid.stp7850755editdlrm
syscallsrw.meta4890644editdlrm
syscallsrw.stp3750755editdlrm
thread-times.meta3840644editdlrm
thread-times.stp12410755editdlrm
thread-times.txt10090644editdlrm
timeout.meta7280644editdlrm
timeout.stp27750755editdlrm
topsys.meta4460644editdlrm
topsys.stp7450755editdlrm
ucalls.meta10650644editdlrm
ucalls.stp35440755editdlrm
Edit: /usr/share/systemtap/examples/profiling/sched_switch.stp (2127B)
#!/usr/bin/stap /* This script works similar to ftrace's sched_switch. It displays a list of * processes which get switched in and out of the scheduler. The format of display * is PROCESS_NAME PROCESS_PID CPU TIMESTAMP PID: PRIORITY: PROCESS STATE ->/+ * NEXT_PID : NEXT_PRIORITY: NEXT_STATE NEXT_PROCESS_NAME * -> indicates that prev process is scheduled out and the next process is * scheduled in. * + indicates that prev process has woken up the next process. * The usage is sched_switch.stp <"pid"/"name"> pid/name */ global target_pid global target_name function state_calc(state) { if(state == 0) status = "R" if(state == 1) status = "S" if(state == 2) status = "D" if(state == 4) status = "T" if(state == 8) status = "T" if(state == 16) status = "Z" if(state == 32) status = "EXIT_DEAD" return status } probe scheduler.wakeup { if (target_pid != 0 && task_pid != target_pid && pid() != target_pid) next if (target_name != "" && task_execname(task) != target_name && execname() != target_name) next printf("%-16s%5d %5d %5d:%5d:%s + %5d:%5d:%s %-16s\n", execname(), task_cpu(task), gettimeofday_ns(), pid(), task_prio(task_current()), state_calc(task_state(task_current())), task_pid(task), task_prio(task), state_calc(task_state(task)), task_execname(task)) } probe scheduler.ctxswitch { if (target_pid != 0 && next_pid != target_pid && prev_pid != target_pid) next if (target_name != "" && prev_task_name != target_name && next_task_name != target_name) next printf("%-16s%5d %5d %5d:%5d:%s ==> %5d:%5d:%s %-16s\n",prev_task_name, task_cpu(prev_task),gettimeofday_ns(),prev_pid,prev_priority,state_calc(prevtsk_state),next_pid, next_priority,state_calc(nexttsk_state),next_task_name) } probe begin { target_pid = 0 target_name = "" %( $# == 1 || $# > 2 %? log("Wrong number of arguments, use none, 'pid nr' or 'name proc'") exit() %) %( $# == 2 %? if(@1 == "pid") target_pid = strtol(@2, 10) if(@1 == "name") target_name = @2 %) }