public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Documentation / sample code fixes for tracepoints
@ 2009-03-24 20:00 Jody McIntyre
  2009-03-24 20:18 ` Mathieu Desnoyers
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jody McIntyre @ 2009-03-24 20:00 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, Mathieu Desnoyers

Fix the tracepoint documentation to refer to "tracepoint-sample" instead of
"tracepoint-example" to match what actually exists; fix the directory,
and clarify how to compile.

Change every instance of "example" in the sample tracepoint code to "sample"
for consistency.

Signed-off-by: Jody McIntyre <scjody@sun.com>

Index: linux-2.6/Documentation/tracepoints.txt
===================================================================
--- linux-2.6.orig/Documentation/tracepoints.txt
+++ linux-2.6/Documentation/tracepoints.txt
@@ -103,13 +103,14 @@ used to export the defined tracepoints.
 
 * Probe / tracepoint example
 
-See the example provided in samples/tracepoints/src
+See the example provided in samples/tracepoints
 
-Compile them with your kernel.
+Compile them with your kernel.  They are built during 'make' (not
+'make modules') when CONFIG_SAMPLE_TRACEPOINTS=m.
 
 Run, as root :
-modprobe tracepoint-example (insmod order is not important)
-modprobe tracepoint-probe-example
-cat /proc/tracepoint-example (returns an expected error)
-rmmod tracepoint-example tracepoint-probe-example
+modprobe tracepoint-sample (insmod order is not important)
+modprobe tracepoint-probe-sample
+cat /proc/tracepoint-sample (returns an expected error)
+rmmod tracepoint-sample tracepoint-probe-sample
 dmesg
Index: linux-2.6/samples/tracepoints/tracepoint-sample.c
===================================================================
--- linux-2.6.orig/samples/tracepoints/tracepoint-sample.c
+++ linux-2.6/samples/tracepoints/tracepoint-sample.c
@@ -1,6 +1,6 @@
 /* tracepoint-sample.c
  *
- * Executes a tracepoint when /proc/tracepoint-example is opened.
+ * Executes a tracepoint when /proc/tracepoint-sample is opened.
  *
  * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
  *
@@ -16,7 +16,7 @@
 DEFINE_TRACE(subsys_event);
 DEFINE_TRACE(subsys_eventb);
 
-struct proc_dir_entry *pentry_example;
+struct proc_dir_entry *pentry_sample;
 
 static int my_open(struct inode *inode, struct file *file)
 {
@@ -32,25 +32,25 @@ static struct file_operations mark_ops =
 	.open = my_open,
 };
 
-static int __init example_init(void)
+static int __init sample_init(void)
 {
-	printk(KERN_ALERT "example init\n");
-	pentry_example = proc_create("tracepoint-example", 0444, NULL,
+	printk(KERN_ALERT "sample init\n");
+	pentry_sample = proc_create("tracepoint-sample", 0444, NULL,
 		&mark_ops);
-	if (!pentry_example)
+	if (!pentry_sample)
 		return -EPERM;
 	return 0;
 }
 
-static void __exit example_exit(void)
+static void __exit sample_exit(void)
 {
-	printk(KERN_ALERT "example exit\n");
-	remove_proc_entry("tracepoint-example", NULL);
+	printk(KERN_ALERT "sample exit\n");
+	remove_proc_entry("tracepoint-sample", NULL);
 }
 
-module_init(example_init)
-module_exit(example_exit)
+module_init(sample_init)
+module_exit(sample_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Tracepoint example");
+MODULE_DESCRIPTION("Tracepoint sample");

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation / sample code fixes for tracepoints
  2009-03-24 20:00 [PATCH] Documentation / sample code fixes for tracepoints Jody McIntyre
@ 2009-03-24 20:18 ` Mathieu Desnoyers
  2009-03-24 21:32 ` Ingo Molnar
  2009-03-24 21:33 ` [tip:tracing/docs] tracing: " Jody McIntyre
  2 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2009-03-24 20:18 UTC (permalink / raw)
  To: Jody McIntyre, Ingo Molnar, Greg KH; +Cc: torvalds, linux-kernel

* Jody McIntyre (scjody@sun.com) wrote:
> Fix the tracepoint documentation to refer to "tracepoint-sample" instead of
> "tracepoint-example" to match what actually exists; fix the directory,
> and clarify how to compile.
> 
> Change every instance of "example" in the sample tracepoint code to "sample"
> for consistency.
> 
> Signed-off-by: Jody McIntyre <scjody@sun.com>
> 

Yes, this documentation/samples fix is indeed needed. It should go
through Ingo's tracing tree, and then also be applied to the -stable
kernels. I have verified that the samples still build correctly.

Meanwhile, I'm pulling it in the -lttng tree.

Thanks !

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

P.S. : Ah, Sun is looking at the tracepoints ? ;-)

> Index: linux-2.6/Documentation/tracepoints.txt
> ===================================================================
> --- linux-2.6.orig/Documentation/tracepoints.txt
> +++ linux-2.6/Documentation/tracepoints.txt
> @@ -103,13 +103,14 @@ used to export the defined tracepoints.
>  
>  * Probe / tracepoint example
>  
> -See the example provided in samples/tracepoints/src
> +See the example provided in samples/tracepoints
>  
> -Compile them with your kernel.
> +Compile them with your kernel.  They are built during 'make' (not
> +'make modules') when CONFIG_SAMPLE_TRACEPOINTS=m.
>  
>  Run, as root :
> -modprobe tracepoint-example (insmod order is not important)
> -modprobe tracepoint-probe-example
> -cat /proc/tracepoint-example (returns an expected error)
> -rmmod tracepoint-example tracepoint-probe-example
> +modprobe tracepoint-sample (insmod order is not important)
> +modprobe tracepoint-probe-sample
> +cat /proc/tracepoint-sample (returns an expected error)
> +rmmod tracepoint-sample tracepoint-probe-sample
>  dmesg
> Index: linux-2.6/samples/tracepoints/tracepoint-sample.c
> ===================================================================
> --- linux-2.6.orig/samples/tracepoints/tracepoint-sample.c
> +++ linux-2.6/samples/tracepoints/tracepoint-sample.c
> @@ -1,6 +1,6 @@
>  /* tracepoint-sample.c
>   *
> - * Executes a tracepoint when /proc/tracepoint-example is opened.
> + * Executes a tracepoint when /proc/tracepoint-sample is opened.
>   *
>   * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
>   *
> @@ -16,7 +16,7 @@
>  DEFINE_TRACE(subsys_event);
>  DEFINE_TRACE(subsys_eventb);
>  
> -struct proc_dir_entry *pentry_example;
> +struct proc_dir_entry *pentry_sample;
>  
>  static int my_open(struct inode *inode, struct file *file)
>  {
> @@ -32,25 +32,25 @@ static struct file_operations mark_ops =
>  	.open = my_open,
>  };
>  
> -static int __init example_init(void)
> +static int __init sample_init(void)
>  {
> -	printk(KERN_ALERT "example init\n");
> -	pentry_example = proc_create("tracepoint-example", 0444, NULL,
> +	printk(KERN_ALERT "sample init\n");
> +	pentry_sample = proc_create("tracepoint-sample", 0444, NULL,
>  		&mark_ops);
> -	if (!pentry_example)
> +	if (!pentry_sample)
>  		return -EPERM;
>  	return 0;
>  }
>  
> -static void __exit example_exit(void)
> +static void __exit sample_exit(void)
>  {
> -	printk(KERN_ALERT "example exit\n");
> -	remove_proc_entry("tracepoint-example", NULL);
> +	printk(KERN_ALERT "sample exit\n");
> +	remove_proc_entry("tracepoint-sample", NULL);
>  }
>  
> -module_init(example_init)
> -module_exit(example_exit)
> +module_init(sample_init)
> +module_exit(sample_exit)
>  
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Mathieu Desnoyers");
> -MODULE_DESCRIPTION("Tracepoint example");
> +MODULE_DESCRIPTION("Tracepoint sample");

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation / sample code fixes for tracepoints
  2009-03-24 20:00 [PATCH] Documentation / sample code fixes for tracepoints Jody McIntyre
  2009-03-24 20:18 ` Mathieu Desnoyers
@ 2009-03-24 21:32 ` Ingo Molnar
  2009-03-25 12:25   ` Jody McIntyre
  2009-03-24 21:33 ` [tip:tracing/docs] tracing: " Jody McIntyre
  2 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-03-24 21:32 UTC (permalink / raw)
  To: Jody McIntyre, Steven Rostedt, Frédéric Weisbecker
  Cc: torvalds, linux-kernel, Mathieu Desnoyers


* Jody McIntyre <scjody@sun.com> wrote:

> Fix the tracepoint documentation to refer to "tracepoint-sample" 
> instead of "tracepoint-example" to match what actually exists; fix 
> the directory, and clarify how to compile.
> 
> Change every instance of "example" in the sample tracepoint code 
> to "sample" for consistency.
> 
> Signed-off-by: Jody McIntyre <scjody@sun.com>

Applied to -tip:tracing/docs, thanks Jody! The latest tracing tree 
can be found at:

  http://people.redhat.com/mingo/tip.git/README

Note, the tracepoint examples are a bit outdated - they should 
probably include examples of full-blown field-enumeated 'combo' 
tracepoints like TRACE_EVENT().

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:tracing/docs] tracing: Documentation / sample code fixes for tracepoints
  2009-03-24 20:00 [PATCH] Documentation / sample code fixes for tracepoints Jody McIntyre
  2009-03-24 20:18 ` Mathieu Desnoyers
  2009-03-24 21:32 ` Ingo Molnar
@ 2009-03-24 21:33 ` Jody McIntyre
  2 siblings, 0 replies; 5+ messages in thread
From: Jody McIntyre @ 2009-03-24 21:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mathieu.desnoyers, hpa, mingo, scjody, tglx, mingo

Commit-ID:  0a5d649018b151cb9331c213a843ac4a3e7e44ab
Gitweb:     http://git.kernel.org/tip/0a5d649018b151cb9331c213a843ac4a3e7e44ab
Author:     Jody McIntyre <scjody@sun.com>
AuthorDate: Tue, 24 Mar 2009 16:00:28 -0400
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 24 Mar 2009 22:32:12 +0100

tracing: Documentation / sample code fixes for tracepoints

Fix the tracepoint documentation to refer to "tracepoint-sample"
instead of "tracepoint-example" to match what actually exists;
fix the directory, and clarify how to compile.

Change every instance of "example" in the sample tracepoint code
to "sample" for consistency.

Signed-off-by: Jody McIntyre <scjody@sun.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: torvalds@linux-foundation.org
LKML-Reference: <20090324200027.GH8294@clouds>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/tracepoints.txt           |   13 +++++++------
 samples/tracepoints/tracepoint-sample.c |   24 ++++++++++++------------
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/Documentation/tracepoints.txt b/Documentation/tracepoints.txt
index 4ff43c6..c0e1cee 100644
--- a/Documentation/tracepoints.txt
+++ b/Documentation/tracepoints.txt
@@ -103,13 +103,14 @@ used to export the defined tracepoints.
 
 * Probe / tracepoint example
 
-See the example provided in samples/tracepoints/src
+See the example provided in samples/tracepoints
 
-Compile them with your kernel.
+Compile them with your kernel.  They are built during 'make' (not
+'make modules') when CONFIG_SAMPLE_TRACEPOINTS=m.
 
 Run, as root :
-modprobe tracepoint-example (insmod order is not important)
-modprobe tracepoint-probe-example
-cat /proc/tracepoint-example (returns an expected error)
-rmmod tracepoint-example tracepoint-probe-example
+modprobe tracepoint-sample (insmod order is not important)
+modprobe tracepoint-probe-sample
+cat /proc/tracepoint-sample (returns an expected error)
+rmmod tracepoint-sample tracepoint-probe-sample
 dmesg
diff --git a/samples/tracepoints/tracepoint-sample.c b/samples/tracepoints/tracepoint-sample.c
index 68d5dc0..9cf80a1 100644
--- a/samples/tracepoints/tracepoint-sample.c
+++ b/samples/tracepoints/tracepoint-sample.c
@@ -1,6 +1,6 @@
 /* tracepoint-sample.c
  *
- * Executes a tracepoint when /proc/tracepoint-example is opened.
+ * Executes a tracepoint when /proc/tracepoint-sample is opened.
  *
  * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
  *
@@ -16,7 +16,7 @@
 DEFINE_TRACE(subsys_event);
 DEFINE_TRACE(subsys_eventb);
 
-struct proc_dir_entry *pentry_example;
+struct proc_dir_entry *pentry_sample;
 
 static int my_open(struct inode *inode, struct file *file)
 {
@@ -32,25 +32,25 @@ static struct file_operations mark_ops = {
 	.open = my_open,
 };
 
-static int __init example_init(void)
+static int __init sample_init(void)
 {
-	printk(KERN_ALERT "example init\n");
-	pentry_example = proc_create("tracepoint-example", 0444, NULL,
+	printk(KERN_ALERT "sample init\n");
+	pentry_sample = proc_create("tracepoint-sample", 0444, NULL,
 		&mark_ops);
-	if (!pentry_example)
+	if (!pentry_sample)
 		return -EPERM;
 	return 0;
 }
 
-static void __exit example_exit(void)
+static void __exit sample_exit(void)
 {
-	printk(KERN_ALERT "example exit\n");
-	remove_proc_entry("tracepoint-example", NULL);
+	printk(KERN_ALERT "sample exit\n");
+	remove_proc_entry("tracepoint-sample", NULL);
 }
 
-module_init(example_init)
-module_exit(example_exit)
+module_init(sample_init)
+module_exit(sample_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Tracepoint example");
+MODULE_DESCRIPTION("Tracepoint sample");

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation / sample code fixes for tracepoints
  2009-03-24 21:32 ` Ingo Molnar
@ 2009-03-25 12:25   ` Jody McIntyre
  0 siblings, 0 replies; 5+ messages in thread
From: Jody McIntyre @ 2009-03-25 12:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Steven Rostedt, Frédéric Weisbecker, torvalds,
	linux-kernel, Mathieu Desnoyers

Hi Ingo,

On Tue, Mar 24, 2009 at 10:32:43PM +0100, Ingo Molnar wrote:

> Applied to -tip:tracing/docs, thanks Jody! The latest tracing tree 
> can be found at:
> 
>   http://people.redhat.com/mingo/tip.git/README

OK, I was not aware of this tree or that you were responsible.  Perhaps
a TRACING entry should be added to MAINTAINERS.

Cheers,
Jody

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-25 12:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 20:00 [PATCH] Documentation / sample code fixes for tracepoints Jody McIntyre
2009-03-24 20:18 ` Mathieu Desnoyers
2009-03-24 21:32 ` Ingo Molnar
2009-03-25 12:25   ` Jody McIntyre
2009-03-24 21:33 ` [tip:tracing/docs] tracing: " Jody McIntyre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox