summaryrefslogtreecommitdiffstats
path: root/runtime/probes/where_func
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/probes/where_func')
-rw-r--r--runtime/probes/where_func/Makefile2
-rw-r--r--runtime/probes/where_func/kprobe_where_funct.c27
-rwxr-xr-xruntime/probes/where_func/stp39
3 files changed, 58 insertions, 10 deletions
diff --git a/runtime/probes/where_func/Makefile b/runtime/probes/where_func/Makefile
index 1e6b9d2e..431ddc4f 100644
--- a/runtime/probes/where_func/Makefile
+++ b/runtime/probes/where_func/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 := kprobe_where_funct.o
diff --git a/runtime/probes/where_func/kprobe_where_funct.c b/runtime/probes/where_func/kprobe_where_funct.c
index e527fa03..027a40de 100644
--- a/runtime/probes/where_func/kprobe_where_funct.c
+++ b/runtime/probes/where_func/kprobe_where_funct.c
@@ -6,9 +6,10 @@
#define HASH_TABLE_BITS 8
#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 "map.c"
#include "probes.c"
#include "current.c"
@@ -47,7 +48,10 @@ static struct kprobe kp[] = {
int init_module(void)
{
int ret;
-
+
+ if (_stp_netlink_open() < 0)
+ return -1;
+
funct_locations = _stp_map_new(1000, INT64);
if (funct_name)
@@ -58,23 +62,28 @@ int init_module(void)
return ret;
}
-void cleanup_module(void)
+static void probe_exit (void)
{
struct map_node_int64 *ptr;
_stp_unregister_kprobes (kp, MAX_KPROBES);
- dlog("%s() called %d times.\n", funct_name, count_funct);
- dlog("NUM\tCaller Addr\tCaller Name\n", funct_name);
+ _stp_printf("%s() called %d times.\n", funct_name, count_funct);
+ _stp_printf("NUM\tCaller\n", funct_name);
/* now walk the hash table and print out all the information */
foreach(funct_locations, ptr) {
- _stp_scbuf_clear();
- _stp_symbol_sprint (key1int(ptr));
- dlog("%lld\t0x%p\t(%s)\n", ptr->val, key1int(ptr), _stp_scbuf);
+ _stp_printf("%lld\t", ptr->val);
+ _stp_symbol_print (key1int(ptr));
+ _stp_print_flush();
}
-
+
_stp_map_del(funct_locations);
}
+void cleanup_module(void)
+{
+ _stp_netlink_close();
+}
+
MODULE_LICENSE("GPL");
diff --git a/runtime/probes/where_func/stp b/runtime/probes/where_func/stp
new file mode 100755
index 00000000..d10fcaab
--- /dev/null
+++ b/runtime/probes/where_func/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