summaryrefslogtreecommitdiffstats
path: root/kernelcalltimes
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-06-10 11:21:37 -0400
committerSteve Dickson <steved@redhat.com>2009-06-10 11:21:37 -0400
commitdfdce363041b4fb72910837174bf40019923c9bc (patch)
tree827cf40c3a311e8314c0e6719cebd7e0c34919ec /kernelcalltimes
parentaaa6513f6db3a54691cfa7022bfbd979db42672e (diff)
downloadsystemtap-dfdce363041b4fb72910837174bf40019923c9bc.tar.gz
systemtap-dfdce363041b4fb72910837174bf40019923c9bc.tar.xz
systemtap-dfdce363041b4fb72910837174bf40019923c9bc.zip
Reorganised scripts into local directories
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'kernelcalltimes')
-rwxr-xr-xkernelcalltimes177
1 files changed, 0 insertions, 177 deletions
diff --git a/kernelcalltimes b/kernelcalltimes
deleted file mode 100755
index 0f88caf..0000000
--- a/kernelcalltimes
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/bin/bash
-do_sort=0
-sort_ave=0
-sort_cnt=0
-sort_min=0
-sort_max=0
-sort_tot=0
-show_all=1
-pname=""
-verbose=""
-function usage {
- echo "Usage: ext3calltimes [-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 " -p - process name to monitor"
- echo " -t - sort by Total ns"
- echo " -v - turn on SystemTap debugging"
- echo " -h - print this help text"
-}
-while getopts Aachnmp:tv 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 ;;
- p) pname=$OPTARG;;
- 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, pname_str
-
-probe begin {
- pname_str = "'$pname'"
- if (pname_str != "") {
- printf("Collecting ext3 data on '%s' - type Ctrl-C to print output and exit...\n", pname_str);
- } else
- printf("Collecting ext3 data - type Ctrl-C to print output and exit...\n")
-}
-
-probe kernel.function("*@mm/readahead.c")
-{
- if (pname_str != "") {
- if (execname() == pname_str)
- start[probefunc(), tid()] = gettimeofday_ns()
- } else
- start[probefunc(), tid()] = gettimeofday_ns()
-}
-probe kernel.function("*@mm/readahead.c").return
-{
- if (!([probefunc(), tid()] in start)) next
-
- delta = gettimeofday_ns() - start[probefunc(), tid()]
- timebyfunc[probefunc()] <<< delta
-
- delete start[probefunc(), tid()]
-}
-probe kernel.function("*@mm/filemap.c")
-{
- if (pname_str != "") {
- if (execname() == pname_str)
- start[probefunc(), tid()] = gettimeofday_ns()
- } else
- start[probefunc(), tid()] = gettimeofday_ns()
-}
-probe kernel.function("*@mm/filemap.c").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 ext3 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 ext3 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 ext3 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 ext3 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 ext3 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
-}'