lkml.org 
[lkml]   [2010]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] tracing: update trace-events-sample.c
Date
Update the samples/trace_events/trace-events-sample.c to show how to use
trace_set_clr_module_event to enable some events at module load time.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
samples/trace_events/trace-events-sample.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
index aabc4e9..b7212e1 100644
--- a/samples/trace_events/trace-events-sample.c
+++ b/samples/trace_events/trace-events-sample.c
@@ -9,7 +9,10 @@
*/
#define CREATE_TRACE_POINTS
#include "trace-events-sample.h"
+#include <linux/ftrace_event.h>

+char *sample_trace = NULL;
+module_param_named(trace, sample_trace, charp, 0400);

static void simple_thread_func(int cnt)
{
@@ -32,11 +35,18 @@ static struct task_struct *simple_tsk;

static int __init trace_event_init(void)
{
+ int ret = 0;
+
+ if (sample_trace) {
+ ret = trace_set_clr_module_event(THIS_MODULE, sample_trace, 1);
+ if (ret)
+ return ret;
+ }
+
simple_tsk = kthread_run(simple_thread, NULL, "event-sample");
- if (IS_ERR(simple_tsk))
- return -1;
+ ret = PTR_ERR(simple_tsk);

- return 0;
+ return ret;
}

static void __exit trace_event_exit(void)
--
1.7.2.3


\
 
 \ /
  Last update: 2010-11-09 10:15    [W:0.047 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site