3 * Executes a tracepoint when /proc/tracepoint-example is opened.
5 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
11 #include <linux/module.h>
12 #include <linux/sched.h>
13 #include <linux/proc_fs.h>
14 #include "tp-samples-trace.h"
16 DEFINE_TRACE(subsys_event);
17 DEFINE_TRACE(subsys_eventb);
19 struct proc_dir_entry *pentry_example;
21 static int my_open(struct inode *inode, struct file *file)
25 trace_subsys_event(inode, file);
26 for (i = 0; i < 10; i++)
27 trace_subsys_eventb();
31 static struct file_operations mark_ops = {
35 static int example_init(void)
37 printk(KERN_ALERT "example init\n");
38 pentry_example = proc_create("tracepoint-example", 0444, NULL,
45 static void example_exit(void)
47 printk(KERN_ALERT "example exit\n");
48 remove_proc_entry("tracepoint-example", NULL);
51 module_init(example_init)
52 module_exit(example_exit)
54 MODULE_LICENSE("GPL");
55 MODULE_AUTHOR("Mathieu Desnoyers");
56 MODULE_DESCRIPTION("Tracepoint example");