create directories branches, tags, trunk
[lttv.git] / tests / kernel / test-compact.c
index b348e91c759924e517d8edcaa88c79caf12cc57a..0658a8647d15f2bc73c2b12a96f1909d7aad1928 100644 (file)
@@ -4,14 +4,14 @@
  */
 
 
-#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>
+#include <linux/ltt-tracer.h>
+#include <linux/timex.h>
+#include <linux/marker.h>
+#include <linux/proc_fs.h>
 
+struct proc_dir_entry *pentry_test = NULL;
 
 /* Event logged : 4 bytes. Let's use 1MB of
  * buffers. 1MB / 4bytes = 262144 (plus heartbeats). So, if we write 20000
 
 #define NR_LOOPS 20000
 
-static int ltt_test_init(void)
+static int my_open(struct inode *inode, struct file *file)
 {
        unsigned int i;
        cycles_t time1, time2, time;
        cycles_t tot_time = 0;
        unsigned long flags;
-       printk(KERN_ALERT "test init\n");
        
+       printk(KERN_ALERT "test begin\n");
        local_irq_save(flags);
        time1 = get_cycles();
        for(i=0; i<NR_LOOPS; i++) {
-               trace_compact_event_a();
+               _MARK(_MF_DEFAULT | ltt_flag_mask(LTT_FLAG_COMPACT),
+                       compact_event_a, MARK_NOARGS);
+               _MARK(_MF_DEFAULT | ltt_flag_mask(LTT_FLAG_COMPACT),
+                       compact_event_b, "%4b", 0xFFFF);
+               _MARK(_MF_DEFAULT | ltt_flag_mask(LTT_FLAG_COMPACT),
+                       compact_event_c, "%8b", 0xFFFFFFFFULL);
+               _MARK(_MF_DEFAULT | ltt_flag_mask(LTT_FLAG_COMPACT)
+                       | ltt_flag_mask(LTT_FLAG_COMPACT_DATA),
+                       compact_event_d, MARK_NOARGS, 0xFFFF);
+               _MARK(_MF_DEFAULT | ltt_flag_mask(LTT_FLAG_COMPACT)
+                       | ltt_flag_mask(LTT_FLAG_COMPACT_DATA),
+                       compact_event_e, "%8b", 0xFFFF, 0xFFFFFFFFULL);
        }
        time2 = get_cycles();
        time = time2 - time1;
@@ -42,13 +53,28 @@ static int ltt_test_init(void)
        printk(KERN_ALERT "total time : %llu\n", tot_time);
 
        printk(KERN_ALERT "test end\n");
-       
-       return -EAGAIN; /* Fail will directly unload the module */
+       return -EPERM;
+}
+
+static struct file_operations mark_ops = {
+       .open = my_open,
+};
+
+static int ltt_test_init(void)
+{
+       printk(KERN_ALERT "test init\n");
+       pentry_test = create_proc_entry("test-compact", 0444, NULL);
+       if (pentry_test)
+               pentry_test->proc_fops = &mark_ops;
+       else
+               return -EPERM;
+       return 0;
 }
 
 static void ltt_test_exit(void)
 {
        printk(KERN_ALERT "test exit\n");
+       remove_proc_entry("test-compact", NULL);
 }
 
 module_init(ltt_test_init)
This page took 0.025898 seconds and 4 git commands to generate.