diff options
Diffstat (limited to 'runtime/probes/tasklet')
-rw-r--r-- | runtime/probes/tasklet/Makefile | 2 | ||||
-rwxr-xr-x | runtime/probes/tasklet/stp | 39 | ||||
-rw-r--r-- | runtime/probes/tasklet/stp_tasklet.c | 23 |
3 files changed, 57 insertions, 7 deletions
diff --git a/runtime/probes/tasklet/Makefile b/runtime/probes/tasklet/Makefile index 369929c4..dde45d2c 100644 --- a/runtime/probes/tasklet/Makefile +++ b/runtime/probes/tasklet/Makefile @@ -3,7 +3,7 @@ # # 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)\ +CFLAGS += -I $(STP_RUNTIME) -I $(STP_RUNTIME)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME)\ -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) obj-m := stp_tasklet.o diff --git a/runtime/probes/tasklet/stp b/runtime/probes/tasklet/stp new file mode 100755 index 00000000..d10fcaab --- /dev/null +++ b/runtime/probes/tasklet/stp @@ -0,0 +1,39 @@ +#!/bin/bash +if [ -n "$1" ] +then + modulename=$1 +else + echo "Usage: stp modulename" + exit +fi + +RELAYFS=`lsmod | grep relayfs |awk '{print $1}'` +if [ "$RELAYFS" != "relayfs" ] +then + /sbin/insmod ../../relayfs/relayfs.ko +fi + +if [ ! -d "/mnt/relay" ] +then + mkdir /mnt/relay +fi + +MOUNT=`mount | grep relayfs |awk '{print $1}'` +if [ "$MOUNT" != "relayfs" ] +then + mount -t relayfs relayfs /mnt/relay +fi + +/sbin/insmod $modulename + +# print to screen only, 4 8K buffers +#../../stpd/stpd -p -b 8192 -n 4 + +# print to screen and log to files, 4 8K buffers +../../stpd/stpd -b 8192 -n 4 + +# no screen or log +#../../stpd/stpd -q -b 8192 -n 4 + +# stpd will remove module when it exits +#/sbin/rmmod $modulename diff --git a/runtime/probes/tasklet/stp_tasklet.c b/runtime/probes/tasklet/stp_tasklet.c index aadb0c4c..f9274281 100644 --- a/runtime/probes/tasklet/stp_tasklet.c +++ b/runtime/probes/tasklet/stp_tasklet.c @@ -6,8 +6,10 @@ #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS) #define BUCKETS 16 /* largest histogram width */ +#define STP_NETLINK_ONLY +#define STP_NUM_STRINGS 1 + #include "runtime.h" -#include "io.c" #include "probes.c" MODULE_DESCRIPTION("test jprobes of tasklets"); @@ -16,7 +18,7 @@ MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>"); void inst__rcu_process_callbacks(struct rcu_ctrlblk *rcp, struct rcu_state *rsp, struct rcu_data *rdp) { - dlog ("interrupt=%d\n", in_interrupt()); + _stp_log ("interrupt=%d\n", in_interrupt()); jprobe_return(); } @@ -31,15 +33,24 @@ static struct jprobe stp_probes[] = { static int init_stp(void) { - int ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES); - dlog("instrumentation is enabled...\n"); + int ret; + + if (_stp_netlink_open() < 0) + return -1; + ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES); + _stp_log ("instrumentation is enabled...\n"); return ret; } -static void cleanup_stp(void) +static void probe_exit (void) { _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES); - dlog ("EXIT\n"); + _stp_log ("EXIT\n"); + +} +static void cleanup_stp(void) +{ + _stp_netlink_close(); } module_init(init_stp); |