/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/linetimes.stp (1608B)
#!/usr/bin/stap # # Copyright (C) 2010-2015 Red Hat, Inc. # Written by William Cohen # # The linetimes.stp script takes two arguments: where to find the function # and the function name. linetimes.stp will instrument each line in the # function. It will print out the number of times that the function is # called, a table with the average and maximum time each line takes, # and control flow information when the script exits. # # For example all the lines of the do_unlinkat function: # # stap linetimes.stp kernel do_unlinkat global calls, times, last_pp, region, cfg probe $1.function(@2).call { calls <<< 1 } probe $1.function(@2).return { t = gettimeofday_us() s = times[tid()] if (s) { e = t - s region[last_pp[tid()]] <<< e cfg[last_pp[tid()], pp()] <<< 1 } delete times[tid()] delete last_pp[tid()] } probe $1.statement(@2 "@*:*") { t = gettimeofday_us() s = times[tid()] if (s) { e = t - s region[last_pp[tid()]] <<< e cfg[last_pp[tid()], pp()] <<< 1 } times[tid()] = t last_pp[tid()] = pp() } probe end { printf("\n%s %s call count: %d\n", @1, @2, @count(calls)); printf("\n%-58s %10s %10s\n", "region", "avg(us)", "max(us)"); foreach (p+ in region) { printf("%-58s %10d %10d\n", p, @avg(region[p]), @max(region[p])); } printf("\n\ncontrol flow graph information\n") printf("from\n\tto\n=======================\n") foreach ([src+] in region) { printf("%-s\n", src) foreach ([s,dest+] in cfg[src,*]) { # slice for all dest's printf("\t%-s %d\n", dest, @count(cfg[src,dest])); } } }