Skip to content

Instantly share code, notes, and snippets.

@kokukuma
Created December 1, 2015 07:07
Show Gist options
  • Save kokukuma/9b2bf5f02595546e5472 to your computer and use it in GitHub Desktop.
Save kokukuma/9b2bf5f02595546e5472 to your computer and use it in GitHub Desktop.
global total_time, entry_time
probe begin {
printf("================================================ Syslog Monitoring Started\n")
}
#probe module("nfs").function("*")
#{
# entry_time[pid(), tid()] = gettimeofday_us()
#}
#probe module("nfs").function("*").return
#{
# total_time[execname(), pid(), probefunc()] += gettimeofday_us() - entry_time[pid(), tid()]
#}
probe module("ext4").function("*")
{
entry_time[pid(), tid()] = gettimeofday_us()
}
probe module("ext4").function("*").return
{
total_time[execname(), pid(), probefunc()] += gettimeofday_us() - entry_time[pid(), tid()]
}
probe kernel.function("generic_file_read_iter")
{
entry_time[pid(), tid()] = gettimeofday_us()
}
probe kernel.function("generic_file_read_iter").return
{
total_time[execname(), pid(), probefunc()] += gettimeofday_us() - entry_time[pid(), tid()]
}
probe end {
foreach ([exec, pid, func] in total_time- limit 100){
printf ("%d %s(%d) %s\n", total_time[exec, pid, func], exec, pid, func)
}
printf("\n")
delete total_time
exit()
printf("================================================ end\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment