update probe
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 22 Sep 2006 21:24:35 +0000 (21:24 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 22 Sep 2006 21:24:35 +0000 (21:24 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2135 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/probe.c
tests/kernel/test-mark.c

index 60b38403c5a316fdf66a3a1de0726f0237229684..1b71f9362c626294854d7d1394dcd90f791e62c5 100644 (file)
@@ -20,9 +20,13 @@ endif
        #obj-m += test-printk.o
        #obj-m += test-debugfs.o
        obj-m += test-mark.o
+       obj-m += test-mark-instrumented.o
        obj-m += probe.o
        #obj-m += marker-loader.o
        #obj-m += test-linuxtrace.o
+
+       CFLAGS_test-mark-instrumented.o += -DFORCE_MARK_JUMP_INLINE
+       CFLAGS_test-mark.o += -funroll-all-loops
 else
        KERNELDIR ?= /lib/modules/$(shell uname -r)/build
        PWD := $(shell pwd)
index 4651fc77583659b071ed4645d24771eebf5d5142..6c6b28d400a6dae4b79c3083cdbe9d7b47adc159 100644 (file)
@@ -20,17 +20,49 @@ asmlinkage void do_mark1(const char *format, int value)
        printk("value is %d\n", value);
 }
 
+#define DO_MARK2_FORMAT "%d %s"
+asmlinkage void do_mark2(const char *format, int value, const char *string)
+{
+       __mark_check_format(DO_MARK2_FORMAT, value, string);
+       printk("value is %d %s\n", value, string);
+}
+
+#define DO_MARK3_FORMAT "%d %s %s"
+asmlinkage void do_mark3(const char *format, int value, const char *s1,
+                               const char *s2)
+{
+       __mark_check_format(DO_MARK3_FORMAT, value, s1, s2);
+       printk("value is %d %s %s\n", value, s1, s2);
+}
+
 int init_module(void)
 {
-       return marker_set_probe("subsys_mark1", DO_MARK1_FORMAT,
-                       (marker_probe_func*)do_mark1,
-                       MARKER_CALL);
+       int result;
+       result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT,
+                       (marker_probe_func*)do_mark1);
+       if(result) goto end;
+       result = marker_set_probe("subsys_mark2", DO_MARK2_FORMAT,
+                       (marker_probe_func*)do_mark2);
+       if(result) goto cleanup1;
+       result = marker_set_probe("subsys_mark3", DO_MARK3_FORMAT,
+                       (marker_probe_func*)do_mark3);
+       if(result) goto cleanup2;
+
+       return -result;
+
+cleanup2:
+       marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2);
+cleanup1:
+       marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1);
+end:
+       return -result;
 }
 
 void cleanup_module(void)
 {
-       marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1,
-               MARKER_CALL);
+       marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1);
+       marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2);
+       marker_disable_probe("subsys_mark3", (marker_probe_func*)do_mark3);
 }
 
 MODULE_LICENSE("GPL");
index a2ce7e12a1e81f4ceeac1a814abb9353bba171a1..72874fa4827c5a760004c0609697737ee3ae220d 100644 (file)
@@ -7,15 +7,21 @@
 #include <linux/proc_fs.h>
 #include <linux/sched.h>
 
-int x=7;
+volatile int x=7;
 
 struct proc_dir_entry *pentry = NULL;
 
 static int my_open(struct inode *inode, struct file *file)
 {
-       MARK(subsys_mark1, "%d", 1);
+       unsigned int i;
+
+       for(i=0; i<2; i++) {
+               MARK(subsys_mark1, "%d", 1);
+               x=i;
+               barrier();
+       }
        MARK(subsys_mark2, "%d %s", 2, "blah2");
-       MARK(subsys_mark3, "%d %s", x, "blah3");
+       MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5");
 
        return -EPERM;
 }
This page took 0.025185 seconds and 4 git commands to generate.