mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com,
	chris@chris-wilson.co.uk,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [PATCH 3/4] tracing: update trace-events-sample.c
Date: Tue,  9 Nov 2010 17:12:46 +0800	[thread overview]
Message-ID: <1289293967-31761-3-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1289293967-31761-1-git-send-email-yuanhan.liu@linux.intel.com>

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


  parent reply	other threads:[~2010-11-09  9:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  9:12 [PATCH 1/4] tracing: introduce for_each_token macro Yuanhan Liu
2010-11-09  9:12 ` [PATCH 2/4] tracing: introduce trace_set_clr_module_event Yuanhan Liu
2010-11-09 11:23   ` Yuanhan Liu
2010-11-09 11:27     ` Chris Wilson
2010-11-09 13:20       ` Yuanhan Liu
2010-11-09 13:31         ` Chris Wilson
2010-11-09 13:56           ` Steven Rostedt
2010-11-09 14:06             ` Yuanhan Liu
2010-11-09 13:59           ` Yuanhan Liu
2010-11-09 14:01             ` Steven Rostedt
2010-11-09 14:11           ` [PATCH] Delegate unknown module parameters to interested parties Chris Wilson
2010-11-09 14:39             ` Steven Rostedt
2010-11-10  5:51               ` Rusty Russell
2010-11-10 13:56                 ` Steven Rostedt
2010-11-11  0:35                   ` Rusty Russell
2010-11-11  1:05                     ` Steven Rostedt
2010-11-09  9:12 ` Yuanhan Liu [this message]
2010-11-09  9:12 ` [PATCH 4/4] tracing: update the trace/events.txt documentation Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289293967-31761-3-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome