From 854d896bebf48714b6e14b73d4eab6d9c856aa52 Mon Sep 17 00:00:00 2001 From: hunt Date: Mon, 21 Mar 2005 21:11:13 +0000 Subject: *** empty log message *** --- runtime/probes/where_func/Makefile | 11 ++++ runtime/probes/where_func/README | 19 +++++++ runtime/probes/where_func/build | 16 ++++++ runtime/probes/where_func/kprobe_where_funct.c | 78 ++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 runtime/probes/where_func/Makefile create mode 100644 runtime/probes/where_func/README create mode 100755 runtime/probes/where_func/build create mode 100644 runtime/probes/where_func/kprobe_where_funct.c (limited to 'runtime/probes/where_func') diff --git a/runtime/probes/where_func/Makefile b/runtime/probes/where_func/Makefile new file mode 100644 index 00000000..1e6b9d2e --- /dev/null +++ b/runtime/probes/where_func/Makefile @@ -0,0 +1,11 @@ +# Makefile +# +# +# make -C path/to/kernel/src M=`pwd` modules STP_RUNTIME=path_to_systemtap_rt + +CFLAGS += -I $(STP_RUNTIME) -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) \ + -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) +obj-m := kprobe_where_funct.o + +clean: + /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions diff --git a/runtime/probes/where_func/README b/runtime/probes/where_func/README new file mode 100644 index 00000000..0df3d719 --- /dev/null +++ b/runtime/probes/where_func/README @@ -0,0 +1,19 @@ +This is a silly little instrumentation routine to instrument functions +entry by name. It makes use of the SystemTap runime libraries break +down the number of times the function by caller. It also uses +__print_symbol to map the address back to locations in functions. + +By default it instruments schedule(). + +The instrumentation module is built by having the kernel that is going +to be instrumented currently on the machine and doing "./build" + +The instrumentation is inserted as root with: + +/sbin/insmod kprobe_funct_where.ko funct_name=function_name + +The instrumentation is removed as root with: + +/sbin/rmmod kprobe_funct_where + +-Will Cohen diff --git a/runtime/probes/where_func/build b/runtime/probes/where_func/build new file mode 100755 index 00000000..3713f08a --- /dev/null +++ b/runtime/probes/where_func/build @@ -0,0 +1,16 @@ +#!/bin/bash + +KVERSION=`uname -r` +echo $KVERSION +KALLSYMS_LOOKUP_NAME=`grep " kallsyms_lookup_name" /boot/System.map-$KVERSION |awk '{print $1}'` +KALLSYMS_LOOKUP=`grep " kallsyms_lookup$" /boot/System.map-$KVERSION |awk '{print $1}'` + +make V=1 -C /lib/modules/`uname -r`/build M=`pwd` modules \ + KALLSYMS_LOOKUP_NAME=0x$KALLSYMS_LOOKUP_NAME \ + KALLSYMS_LOOKUP=0x$KALLSYMS_LOOKUP \ + STP_RUNTIME=`pwd`/../.. + + + + + diff --git a/runtime/probes/where_func/kprobe_where_funct.c b/runtime/probes/where_func/kprobe_where_funct.c new file mode 100644 index 00000000..f90f71bc --- /dev/null +++ b/runtime/probes/where_func/kprobe_where_funct.c @@ -0,0 +1,78 @@ +/* kprobe_where_funct.c + this is a simple module to get information about calls to a function that is passed as a module option + Will Cohen +*/ + +#define HASH_TABLE_BITS 8 +#define HASH_TABLE_SIZE (1<val, key1int(ptr), _stp_pbuf); + } + + _stp_map_del(funct_locations); +} + +MODULE_LICENSE("GPL"); -- cgit