3 * Executes a tracepoint when /proc/tracepoint-sample 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_sample;
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 const struct file_operations mark_ops = {
33 .llseek = noop_llseek,
36 static int __init sample_init(void)
38 printk(KERN_ALERT "sample init\n");
39 pentry_sample = proc_create("tracepoint-sample", 0444, NULL,
46 static void __exit sample_exit(void)
48 printk(KERN_ALERT "sample exit\n");
49 remove_proc_entry("tracepoint-sample", NULL);
52 module_init(sample_init)
53 module_exit(sample_exit)
55 MODULE_LICENSE("GPL");
56 MODULE_AUTHOR("Mathieu Desnoyers");
57 MODULE_DESCRIPTION("Tracepoint sample");