summaryrefslogtreecommitdiffstats
path: root/rpccalltimes
diff options
context:
space:
mode:
authorSteve Dickson <steved#redhat.com>2008-05-29 13:53:00 -0400
committerSteve Dickson <steved#redhat.com>2008-05-29 13:53:00 -0400
commit916ea54791f05bf70be648e4e0ea8deea98e682f (patch)
treef6944eb832b7927896e3c72447edae75453aff1e /rpccalltimes
parentf247e9e3d6c230a77c3ede1894ef65cb0cda180e (diff)
downloadsystemtap-916ea54791f05bf70be648e4e0ea8deea98e682f.tar.gz
systemtap-916ea54791f05bf70be648e4e0ea8deea98e682f.tar.xz
systemtap-916ea54791f05bf70be648e4e0ea8deea98e682f.zip
Added syscalltimes rpccalltimes nfsdcalltimes
Diffstat (limited to 'rpccalltimes')
-rwxr-xr-xrpccalltimes149
1 files changed, 149 insertions, 0 deletions
diff --git a/rpccalltimes b/rpccalltimes
new file mode 100755
index 0000000..fcf3fe5
--- /dev/null
+++ b/rpccalltimes
@@ -0,0 +1,149 @@
+#!/bin/bash
+do_sort=0
+sort_ave=0
+sort_cnt=0
+sort_min=0
+sort_max=0
+sort_tot=0
+show_all=1
+verbose=""
+function usage {
+ echo "Usage: rpccalltimes [-Aachnmtv]"
+ echo " -A - Do all possible sorting"
+ echo " -a - sort by Ave ns"
+ echo " -c - sort by Count"
+ echo " -n - sort by Min ns"
+ echo " -m - sort by Max ns"
+ echo " -t - sort by Total ns"
+ echo " -v - turn on SystemTap debugging"
+ echo " -h - print this help text"
+}
+while getopts Aachnmtv option; do
+ case $option in
+ A) sort_ave=1; sort_cnt=1; sort_min=1;
+ sort_max=1; sort_tot=1; do_sort=1;;
+ a) sort_ave=1; do_sort=1;;
+ c) sort_cnt=1; do_sort=1 ;;
+ n) sort_min=1; do_sort=1 ;;
+ m) sort_max=1; do_sort=1 ;;
+ t) sort_tot=1; do_sort=1 ;;
+ v) verbose="-v "$verbose ;;
+ h|?|*) usage
+ exit 1;;
+ esac
+done
+
+if [ $do_sort -eq 1 ]; then
+ show_all=0
+fi
+echo "Creating and building SystemTap module..."
+
+stap "$verbose" -e '
+global timebyfunc, top
+global start
+
+probe begin {
+ printf("Collecting rpc data - type Ctrl-C to print output and exit...\n")
+}
+
+probe module("sunrpc").function("*@net/sunrpc/*")
+{
+ start[probefunc(), tid()] = gettimeofday_ns()
+}
+probe module("sunrpc").function("*@net/sunrpc/*").return
+{
+ if (!([probefunc(), tid()] in start)) next
+
+ delta = gettimeofday_ns() - start[probefunc(), tid()]
+ timebyfunc[probefunc()] <<< delta
+
+ delete start[probefunc(), tid()]
+}
+function print_header() {
+ printf("%-26s %10s %12s %12s %12s %12s\n",
+ "Call", "Count", "Total ns",
+ "Avg ns", "Min ns", "Max ns")
+}
+probe end {
+ if ('$sort_ave' != 0) {
+ printf("\nSorted rpc data by Avg ns \n")
+ print_header()
+ foreach (call in timebyfunc)
+ top[call] = @avg(timebyfunc[call])
+ foreach (call in top- limit 20)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ delete top
+ }
+ if ('$sort_cnt' != 0) {
+ printf("\nSorted rpc data by Count\n")
+ print_header()
+ foreach (call in timebyfunc)
+ top[call] = @count(timebyfunc[call])
+ foreach (call in top- limit 20)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ delete top
+ }
+ if ('$sort_tot' != 0) {
+ printf("\nSorted rpc data by Total ns\n")
+ print_header()
+ foreach (call in timebyfunc)
+ top[call] = @sum(timebyfunc[call])
+ foreach (call in top- limit 20)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ delete top
+ }
+ if ('$sort_min' != 0) {
+ printf("\nSorted rpc data by Min ns\n")
+ print_header()
+ foreach (call in timebyfunc)
+ top[call] = @min(timebyfunc[call])
+ foreach (call in top- limit 20)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ delete top
+ }
+ if ('$sort_max' != 0) {
+ printf("\nSorted rpc data by Max ns\n")
+ print_header()
+ foreach (call in timebyfunc)
+ top[call] = @min(timebyfunc[call])
+ foreach (call in top- limit 20)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ delete top
+ }
+ if ('$show_all' != 0) {
+ print_header()
+ foreach (call in timebyfunc)
+ printf("%-26s %10d %12d %12d %12d %12d\n", call,
+ @count(timebyfunc[call]),
+ @sum(timebyfunc[call]),
+ @avg(timebyfunc[call]),
+ @min(timebyfunc[call]),
+ @max(timebyfunc[call]))
+ }
+ delete timebyfunc
+}'