add compact test
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 13 Mar 2007 01:01:46 +0000 (01:01 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 13 Mar 2007 01:01:46 +0000 (01:01 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2417 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/test-compact.c [new file with mode: 0644]

index 1d947906b9dd201ec0c3bf62aaceea84688d23e2..95549140bbf63f14aa194b55551c75fb3159249f 100644 (file)
@@ -3,6 +3,7 @@ ifneq ($(CONFIG_LTT),)
        obj-m += ltt-facility-loader-tests.o
 #      obj-m += test-time-probe.o 
        obj-m += test-time-probe2.o 
+       obj-m += test-compact.o 
 #      obj-m += test-instrument-size-small.o
 #      obj-m += test-instrument-size-med.o
 #      obj-m += test-instrument-size-big.o
diff --git a/tests/kernel/test-compact.c b/tests/kernel/test-compact.c
new file mode 100644 (file)
index 0000000..b348e91
--- /dev/null
@@ -0,0 +1,60 @@
+/* test-time-probe.c
+ *
+ * Test time spent in a LTTng instrumentation probe.
+ */
+
+
+#define CONFIG_LTT_FACILITY_COMPACT
+#include <ltt/ltt-facility-select-compact.h>
+#include "ltt-facility-compact.h"
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/ltt-core.h>
+
+
+/* Event logged : 4 bytes. Let's use 1MB of
+ * buffers. 1MB / 4bytes = 262144 (plus heartbeats). So, if we write 20000
+ * event, we should not lose events. Check event lost count after tests. */
+
+#define NR_LOOPS 20000
+
+static int ltt_test_init(void)
+{
+       unsigned int i;
+       cycles_t time1, time2, time;
+       cycles_t tot_time = 0;
+       unsigned long flags;
+       printk(KERN_ALERT "test init\n");
+       
+       local_irq_save(flags);
+       time1 = get_cycles();
+       for(i=0; i<NR_LOOPS; i++) {
+               trace_compact_event_a();
+       }
+       time2 = get_cycles();
+       time = time2 - time1;
+       tot_time += time;
+       local_irq_restore(flags);
+
+       printk(KERN_ALERT "test results : time per probe\n");
+       printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
+       printk(KERN_ALERT "total time : %llu\n", tot_time);
+
+       printk(KERN_ALERT "test end\n");
+       
+       return -EAGAIN; /* Fail will directly unload the module */
+}
+
+static void ltt_test_exit(void)
+{
+       printk(KERN_ALERT "test exit\n");
+}
+
+module_init(ltt_test_init)
+module_exit(ltt_test_exit)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit Test");
+
This page took 0.026471 seconds and 4 git commands to generate.