summaryrefslogtreecommitdiffstats
path: root/runtime/probes
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/probes')
-rw-r--r--runtime/probes/shellsnoop/dtr.c56
-rwxr-xr-xruntime/probes/shellsnoop/stp16
-rwxr-xr-xruntime/probes/tasklet/stp10
-rw-r--r--runtime/probes/tasklet/stp_tasklet.c45
-rw-r--r--runtime/probes/test4/dtr.c33
-rwxr-xr-xruntime/probes/test4/stp10
-rw-r--r--runtime/probes/where_func/kprobe_where_funct.c33
-rwxr-xr-xruntime/probes/where_func/stp13
8 files changed, 178 insertions, 38 deletions
diff --git a/runtime/probes/shellsnoop/dtr.c b/runtime/probes/shellsnoop/dtr.c
index e529b054..b857a618 100644
--- a/runtime/probes/shellsnoop/dtr.c
+++ b/runtime/probes/shellsnoop/dtr.c
@@ -100,36 +100,62 @@ static struct jprobe dtr_probes[] = {
#define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe))
+static unsigned n_subbufs = 4;
+module_param(n_subbufs, uint, 0);
+MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer");
+
+static unsigned subbuf_size = 65536;
+module_param(subbuf_size, uint, 0);
+MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers");
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
static int init_dtr(void)
{
- int ret;
+ int ret;
- if (_stp_netlink_open() < 0)
- return -1;
+ if (!pid) {
+ printk("init_dtr: Can't start without daemon pid\n");
+ return -1;
+ }
- pids = _stp_map_new (10000, INT64);
- arglist = _stp_list_new (10, STRING);
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init_dtr: Couldn't open transport\n");
+ return -1;
+ }
- ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+ pids = _stp_map_new (10000, INT64);
+ arglist = _stp_list_new (10, STRING);
- _stp_log("instrumentation is enabled... %s\n", __this_module.name);
- return ret;
+ ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+
+ printk("instrumentation is enabled... %s\n", __this_module.name);
+
+ return ret;
}
+static int exited; /* FIXME: this is a stopgap - if we don't do this
+ * and are manually removed, bad things happen */
+
static void probe_exit (void)
{
- _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+ exited = 1;
- _stp_print ("In probe_exit now.");
- _stp_map_del (pids);
- _stp_print_flush();
-}
+ _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
+ _stp_print ("In probe_exit now.");
+ _stp_map_del (pids);
+ _stp_print_flush();
+}
static void cleanup_dtr(void)
{
- _stp_netlink_close();
-
+ if (!exited)
+ probe_exit();
+
+ _stp_transport_close();
}
module_init(init_dtr);
diff --git a/runtime/probes/shellsnoop/stp b/runtime/probes/shellsnoop/stp
index d10fcaab..14e8f47a 100755
--- a/runtime/probes/shellsnoop/stp
+++ b/runtime/probes/shellsnoop/stp
@@ -24,13 +24,25 @@ then
mount -t relayfs relayfs /mnt/relay
fi
-/sbin/insmod $modulename
+STP_CONTROL=`lsmod | grep stp_control |awk '{print $1}'`
+if [ "$STP_CONTROL" != "stp_control" ]
+then
+ /sbin/insmod ../../transport/stp-control.ko
+fi
+
+#/sbin/insmod $modulename
# print to screen only, 4 8K buffers
#../../stpd/stpd -p -b 8192 -n 4
+# print to screen
+../../stpd/stpd -b 8192 -n 4 $modulename
+
+# log to files (relayfs), 4 8K buffers
+#../../stpd/stpd -r -b 8192 -n 4 $modulename
+
# print to screen and log to files, 4 8K buffers
-../../stpd/stpd -b 8192 -n 4
+#../../stpd/stpd -b 8192 -n 4
# no screen or log
#../../stpd/stpd -q -b 8192 -n 4
diff --git a/runtime/probes/tasklet/stp b/runtime/probes/tasklet/stp
index d10fcaab..185a5905 100755
--- a/runtime/probes/tasklet/stp
+++ b/runtime/probes/tasklet/stp
@@ -24,13 +24,19 @@ then
mount -t relayfs relayfs /mnt/relay
fi
-/sbin/insmod $modulename
+STP_CONTROL=`lsmod | grep stp_control |awk '{print $1}'`
+if [ "$STP_CONTROL" != "stp_control" ]
+then
+ /sbin/insmod ../../transport/stp-control.ko
+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
+../../stpd/stpd -b 8192 -n 4 $modulename
# no screen or log
#../../stpd/stpd -q -b 8192 -n 4
diff --git a/runtime/probes/tasklet/stp_tasklet.c b/runtime/probes/tasklet/stp_tasklet.c
index f9274281..c3581eb2 100644
--- a/runtime/probes/tasklet/stp_tasklet.c
+++ b/runtime/probes/tasklet/stp_tasklet.c
@@ -30,27 +30,54 @@ static struct jprobe stp_probes[] = {
};
#define MAX_STP_PROBES (sizeof(stp_probes)/sizeof(struct jprobe))
+static unsigned n_subbufs = 4;
+module_param(n_subbufs, uint, 0);
+MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer");
+
+static unsigned subbuf_size = 65536;
+module_param(subbuf_size, uint, 0);
+MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers");
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
static int init_stp(void)
{
- int ret;
+ int ret;
+
+ if (!pid) {
+ printk("init_dtr: Can't start without daemon pid\n");
+ return -1;
+ }
- if (_stp_netlink_open() < 0)
- return -1;
- ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
- _stp_log ("instrumentation is enabled...\n");
- return ret;
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init_dtr: Couldn't open transport\n");
+ return -1;
+ }
+
+ ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
+ printk("instrumentation is enabled...\n");
+ return ret;
}
+static int exited; /* FIXME: this is a stopgap - if we don't do this
+ * and are manually removed, bad things happen */
+
static void probe_exit (void)
{
- _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
- _stp_log ("EXIT\n");
+ exited = 1;
+
+ _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
+ _stp_log ("EXIT\n");
}
static void cleanup_stp(void)
{
- _stp_netlink_close();
+ if (!exited)
+ probe_exit();
+
+ _stp_transport_close();
}
module_init(init_stp);
diff --git a/runtime/probes/test4/dtr.c b/runtime/probes/test4/dtr.c
index 814bb61d..09b0f52d 100644
--- a/runtime/probes/test4/dtr.c
+++ b/runtime/probes/test4/dtr.c
@@ -78,12 +78,31 @@ static struct jprobe dtr_probes[] = {
#define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe))
+static unsigned n_subbufs = 4;
+module_param(n_subbufs, uint, 0);
+MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer");
+
+static unsigned subbuf_size = 65536;
+module_param(subbuf_size, uint, 0);
+MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers");
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
static int init_dtr(void)
{
int ret;
- if (_stp_netlink_open() < 0)
- return -1;
+ if (!pid) {
+ printk("init_dtr: Can't start without daemon pid\n");
+ return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init_dtr: Couldn't open transport\n");
+ return -1;
+ }
opens = _stp_map_new (1000, INT64);
reads = _stp_map_new (1000, STAT);
@@ -96,12 +115,17 @@ static int init_dtr(void)
return ret;
}
+static int exited; /* FIXME: this is a stopgap - if we don't do this
+ * and are manually removed, bad things happen */
+
static void probe_exit (void)
{
struct map_node_stat *st;
struct map_node_int64 *ptr;
struct map_node_str *sptr;
+ exited = 1;
+
_stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
foreach (traces, sptr) {
@@ -133,7 +157,10 @@ static void probe_exit (void)
static void cleanup_dtr(void)
{
- _stp_netlink_close();
+ if (!exited)
+ probe_exit();
+
+ _stp_transport_close();
}
module_init(init_dtr);
diff --git a/runtime/probes/test4/stp b/runtime/probes/test4/stp
index d10fcaab..185a5905 100755
--- a/runtime/probes/test4/stp
+++ b/runtime/probes/test4/stp
@@ -24,13 +24,19 @@ then
mount -t relayfs relayfs /mnt/relay
fi
-/sbin/insmod $modulename
+STP_CONTROL=`lsmod | grep stp_control |awk '{print $1}'`
+if [ "$STP_CONTROL" != "stp_control" ]
+then
+ /sbin/insmod ../../transport/stp-control.ko
+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
+../../stpd/stpd -b 8192 -n 4 $modulename
# no screen or log
#../../stpd/stpd -q -b 8192 -n 4
diff --git a/runtime/probes/where_func/kprobe_where_funct.c b/runtime/probes/where_func/kprobe_where_funct.c
index 027a40de..960f2290 100644
--- a/runtime/probes/where_func/kprobe_where_funct.c
+++ b/runtime/probes/where_func/kprobe_where_funct.c
@@ -45,12 +45,31 @@ static struct kprobe kp[] = {
};
#define MAX_KPROBES (sizeof(kp)/sizeof(struct kprobe))
+static unsigned n_subbufs = 4;
+module_param(n_subbufs, uint, 0);
+MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer");
+
+static unsigned subbuf_size = 65536;
+module_param(subbuf_size, uint, 0);
+MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers");
+
+static int pid;
+module_param(pid, int, 0);
+MODULE_PARM_DESC(pid, "daemon pid");
+
int init_module(void)
{
int ret;
-
- if (_stp_netlink_open() < 0)
+
+ if (!pid) {
+ printk("init_dtr: Can't start without daemon pid\n");
return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init_dtr: Couldn't open transport\n");
+ return -1;
+ }
funct_locations = _stp_map_new(1000, INT64);
@@ -62,10 +81,15 @@ int init_module(void)
return ret;
}
+static int exited; /* FIXME: this is a stopgap - if we don't do this
+ * and are manually removed, bad things happen */
+
static void probe_exit (void)
{
struct map_node_int64 *ptr;
+ exited = 1;
+
_stp_unregister_kprobes (kp, MAX_KPROBES);
_stp_printf("%s() called %d times.\n", funct_name, count_funct);
@@ -83,7 +107,10 @@ static void probe_exit (void)
void cleanup_module(void)
{
- _stp_netlink_close();
+ if (!exited)
+ probe_exit();
+
+ _stp_transport_close();
}
MODULE_LICENSE("GPL");
diff --git a/runtime/probes/where_func/stp b/runtime/probes/where_func/stp
index d10fcaab..ca0cb63c 100755
--- a/runtime/probes/where_func/stp
+++ b/runtime/probes/where_func/stp
@@ -24,13 +24,22 @@ then
mount -t relayfs relayfs /mnt/relay
fi
-/sbin/insmod $modulename
+STP_CONTROL=`lsmod | grep stp_control |awk '{print $1}'`
+if [ "$STP_CONTROL" != "stp_control" ]
+then
+ /sbin/insmod ../../transport/stp-control.ko
+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
+../../stpd/stpd -b 8192 -n 4 $modulename
+
+# 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