/
usr
/
share
/
systemtap
/
examples
/
profiling
/
/usr/share/systemtap/examples/profiling
mkdir
upload
Name
Size
Mode
Actions
container_check.meta
1064
0644
edit
dl
rm
container_check.stp
6323
0755
edit
dl
rm
errno.meta
456
0644
edit
dl
rm
errno.stp
984
0755
edit
dl
rm
fileline-profile.meta
783
0644
edit
dl
rm
fileline-profile.stp
1218
0755
edit
dl
rm
fntimes.meta
512
0644
edit
dl
rm
fntimes.stp
870
0755
edit
dl
rm
fntimes.txt
1375
0644
edit
dl
rm
functioncallcount.meta
649
0644
edit
dl
rm
functioncallcount.stp
490
0755
edit
dl
rm
functioncallcount.tcl
399
0644
edit
dl
rm
graphcall.stp
534
0755
edit
dl
rm
ioctl_handler.meta
1209
0644
edit
dl
rm
ioctl_handler.stp
811
0755
edit
dl
rm
latencytap.meta
877
0644
edit
dl
rm
latencytap.stp
12755
0755
edit
dl
rm
latencytap.tcl
140
0644
edit
dl
rm
latencytap.txt
2104
0644
edit
dl
rm
linetimes.meta
688
0644
edit
dl
rm
linetimes.stp
1608
0755
edit
dl
rm
linetimes.txt
13936
0644
edit
dl
rm
perf.meta
578
0644
edit
dl
rm
perf.stp
1936
0755
edit
dl
rm
perf.tcl
166
0644
edit
dl
rm
periodic.meta
895
0644
edit
dl
rm
periodic.stp
2659
0755
edit
dl
rm
pf2.meta
420
0644
edit
dl
rm
pf2.stp
370
0755
edit
dl
rm
pf2.txt
406
0644
edit
dl
rm
pf3.meta
439
0644
edit
dl
rm
pf3.stp
992
0755
edit
dl
rm
pf3.txt
489
0644
edit
dl
rm
pf4.meta
471
0644
edit
dl
rm
pf4.stp
952
0755
edit
dl
rm
pf4.tcl
79
0644
edit
dl
rm
pf4.txt
754
0644
edit
dl
rm
sched_switch.meta
780
0644
edit
dl
rm
sched_switch.stp
2127
0755
edit
dl
rm
syscallerrorsbypid.meta
1067
0644
edit
dl
rm
syscallerrorsbypid.stp
950
0755
edit
dl
rm
syscalllatency.meta
1072
0644
edit
dl
rm
syscalllatency.stp
989
0755
edit
dl
rm
syscallsbypid.meta
1020
0644
edit
dl
rm
syscallsbypid.stp
785
0755
edit
dl
rm
syscallsrw.meta
489
0644
edit
dl
rm
syscallsrw.stp
375
0755
edit
dl
rm
thread-times.meta
384
0644
edit
dl
rm
thread-times.stp
1241
0755
edit
dl
rm
thread-times.txt
1009
0644
edit
dl
rm
timeout.meta
728
0644
edit
dl
rm
timeout.stp
2775
0755
edit
dl
rm
topsys.meta
446
0644
edit
dl
rm
topsys.stp
745
0755
edit
dl
rm
ucalls.meta
1065
0644
edit
dl
rm
ucalls.stp
3544
0755
edit
dl
rm
Edit:
/usr/share/systemtap/examples/profiling/periodic.stp
(2659B)
#!/usr/bin/stap # Copyright (C) 2011-2016 Red Hat, Inc. # Written by William Cohen <wcohen@redhat.com> # # This script give an idea what periodic things are running on # the system. Usage: # # stap --all-modules periodic.stp global last_expire, period, funct, data, proc_info, delayed_work_info probe kernel.trace("timer_expire_entry") { old_expire = last_expire[$timer] new_expire = gettimeofday_us() if (old_expire) { elapsed = new_expire - old_expire period[$timer] <<< elapsed funct[$timer] = $timer->function data[$timer] = @defined($timer->data) ? $timer->data : 0 proc_info[$timer] = @defined($timer->data) ? 0 : @module_container_of($timer, "kernel", "struct process_timer", timer)->task delayed_work_info[$timer] = @defined($timer->data) ? 0 : & @module_container_of($timer, "kernel", "struct delayed_work", timer) } last_expire[$timer] = new_expire } function output() { printf("%-7s %-50s %15s %25s %9s\n", "#type", "function", "avg period(us)", "period variance(us^2)", "count") # print out the various timers firing foreach([timer] in period-) { fname = symname(funct[timer]) if (fname == "process_timeout") { ptr = (data[timer] ? data[timer] : proc_info[timer]) fname = sprintf("%s(%d)", kernel_string_n(@cast(ptr, "struct task_struct", "kernel<linux/sched.h>")->comm, 16), @cast(ptr, "struct task_struct", "kernel<linux/sched.h>")->pid) type="process" } else if (fname == "delayed_work_timer_fn") { ptr = (data[timer] ? data[timer] : delayed_work_info[timer]) faddr = @defined(@cast(ptr, "struct delayed_work", "kernel<linux/workqueue.h>")->work->func) ? @cast(ptr, "struct delayed_work", "kernel<linux/workqueue.h>")->work->func : @cast(ptr, "struct work_struct", "kernel<linux/workqueue.h>")->func fname = sprintf("%s", symname(faddr)) type="work_q" } else { fileline = symfileline(funct[timer]) if (strtol(fileline, 16)) // fileline is just the address fname = sprintf("%s", symdata(funct[timer])) else fname = sprintf("%s@%s", symname(funct[timer]), fileline) type="kernel" } printf("%-7s %-50.50s %15d %25d %9d\n", type, fname, @avg(period[timer]), @variance(period[timer], 2), @count(period[timer])) } } probe begin { printf("#monitoring timer periods (press control-c for output)\n") } probe end { output() } # allow optional period output from script %( $# > 0 %? probe timer.s($1) { output(); delete last_expire delete period delete funct delete data delete proc_info delete delayed_work_info } %)
Save
cmd:
run