Skip to contentSkip to conversation

tracing: add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

PATCH In review Jason Baron 8 participants 37 messages Dec 1, 2009 – Dec 3, 2009

Subsystems (17)
DRM drivers x86 KVM PowerPC +13 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tracing: add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

The introduction of the new 'DECLARE_EVENT_CLASS()' obviates the need for the 'TRACE_EVENT()' macro in some cases. Thus, docbook style comments that used to live with 'TRACE_EVENT()' are now moved to 'DEFINE_EVENT()'. Thus, we need to make the docbook system understand the new 'DEFINE_EVENT()' macro. In addition I've tried to futureproof the patch, by also adding support for 'DEFINE_SINGLE_EVENT()', since there has been discussion about renaming:
TRACE_EVENT() -> DEFINE_SINGLE_EVENT().

Without this patch the tracepoint docbook fails to build.

I've verified that this patch correctly builds the tracepoint docbook which currently covers signals, and irqs.

Changes in v2:
- properly indent perl 'if' statements

Cc Randy Dunlap <[email protected]>
Cc William Cohen <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Masami Hiramatsu <[email protected]>
---
 scripts/kernel-doc |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
scripts/kernel-doc +12 -3
index ea9f8a5..241310e 100755
@@ -1852,10 +1852,17 @@ sub tracepoint_munge($) {
 	my $tracepointname = 0;
 	my $tracepointargs = 0;
 
-	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+	if ($prototype =~ m/TRACE_EVENT\((.*?),/) {
 		$tracepointname = $1;
 	}
-	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+	if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) {
+		$tracepointname = $2;
+	}
+	$tracepointname =~ s/^\s+//; #strip leading whitespace
+	if ($prototype =~ m/TP_PROTO\((.*?)\)/) {
 		$tracepointargs = $1;
 	}
 	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
@@ -1920,7 +1927,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
-	if ($prototype =~ /TRACE_EVENT/) {
+	if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ ||
+	    $prototype =~ /DEFINE_SINGLE_EVENT/)
+	{
 		tracepoint_munge($file);
 	}
 	dump_function($prototype, $file);
Signature · 1 line
1.6.5.1
Acked-by on v2 1/1
#1 lore raw
Quoted 13 lines · Jason Baron

The introduction of the new 'DECLARE_EVENT_CLASS()' obviates the need for the 'TRACE_EVENT()' macro in some cases. Thus, docbook style comments that used to live with 'TRACE_EVENT()' are now moved to 'DEFINE_EVENT()'. Thus, we need to make the docbook system understand the new 'DEFINE_EVENT()' macro. In addition I've tried to futureproof the patch, by also adding support for 'DEFINE_SINGLE_EVENT()', since there has been discussion about renaming:
TRACE_EVENT() -> DEFINE_SINGLE_EVENT().

Without this patch the tracepoint docbook fails to build.

I've verified that this patch correctly builds the tracepoint docbook which currently covers signals, and irqs.

Quoted 7 lines

Changes in v2:
- properly indent perl 'if' statements

Thanks.

Quoted 43 lines
Cc William Cohen <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Masami Hiramatsu <[email protected]>
---
 scripts/kernel-doc |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
scripts/kernel-doc +12 -3
index ea9f8a5..241310e 100755
@@ -1852,10 +1852,17 @@ sub tracepoint_munge($) {
 	my $tracepointname = 0;
 	my $tracepointargs = 0;
 
-	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+	if ($prototype =~ m/TRACE_EVENT\((.*?),/) {
 		$tracepointname = $1;
 	}
-	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+	if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) {
+		$tracepointname = $2;
+	}
+	$tracepointname =~ s/^\s+//; #strip leading whitespace
+	if ($prototype =~ m/TP_PROTO\((.*?)\)/) {
 		$tracepointargs = $1;
 	}
 	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
@@ -1920,7 +1927,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
-	if ($prototype =~ /TRACE_EVENT/) {
+	if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ ||
+	    $prototype =~ /DEFINE_SINGLE_EVENT/)
+	{
 		tracepoint_munge($file);
 	}
 	dump_function($prototype, $file);
Signature · 1 line
~Randy
#2 lore raw

[tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

In reply to Jason Baron
Commit-ID:  3a9089fd78367e2c6c815129030b790a0f5c2715
Gitweb:     http://git.kernel.org/tip/3a9089fd78367e2c6c815129030b790a0f5c2715
Author:     Jason Baron <[email protected]>
AuthorDate: Tue, 1 Dec 2009 12:18:49 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 2 Dec 2009 09:57:37 +0100

tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

The introduction of the new 'DECLARE_EVENT_CLASS()' obviates the need for the 'TRACE_EVENT()' macro in some cases. Thus, docbook style comments that used to live with 'TRACE_EVENT()' are now moved to 'DEFINE_EVENT()'. Thus, we need to make the docbook system understand the new 'DEFINE_EVENT()' macro. In addition I've tried to futureproof the patch, by also adding support for 'DEFINE_SINGLE_EVENT()', since there has been discussion about
renaming: TRACE_EVENT() -> DEFINE_SINGLE_EVENT().

Without this patch the tracepoint docbook fails to build.

I've verified that this patch correctly builds the tracepoint docbook which currently covers signals, and irqs.

Changes in v2:
- properly indent perl 'if' statements

Cc William Cohen <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Masami Hiramatsu <[email protected]>

LKML-Reference: <200912011718.nB1HIn7t011371@int-mx04.intmail.prod.int.phx2.redhat.com>

---
 scripts/kernel-doc |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
scripts/kernel-doc +12 -3
index ea9f8a5..241310e 100755
@@ -1852,10 +1852,17 @@ sub tracepoint_munge($) {
 	my $tracepointname = 0;
 	my $tracepointargs = 0;
 
-	if($prototype =~ m/TRACE_EVENT\((.*?),/) {
+	if ($prototype =~ m/TRACE_EVENT\((.*?),/) {
 		$tracepointname = $1;
 	}
-	if($prototype =~ m/TP_PROTO\((.*?)\)/) {
+	if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) {
+		$tracepointname = $1;
+	}
+	if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) {
+		$tracepointname = $2;
+	}
+	$tracepointname =~ s/^\s+//; #strip leading whitespace
+	if ($prototype =~ m/TP_PROTO\((.*?)\)/) {
 		$tracepointargs = $1;
 	}
 	if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
@@ -1920,7 +1927,9 @@ sub process_state3_function($$) {
 	if ($prototype =~ /SYSCALL_DEFINE/) {
 		syscall_munge();
 	}
-	if ($prototype =~ /TRACE_EVENT/) {
+	if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ ||
+	    $prototype =~ /DEFINE_SINGLE_EVENT/)
+	{
 		tracepoint_munge($file);
 	}
 	dump_function($prototype, $file);
maintainer
#3 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 8 lines · tip-bot for Jason Baron
Commit-ID:  3a9089fd78367e2c6c815129030b790a0f5c2715
Gitweb:     http://git.kernel.org/tip/3a9089fd78367e2c6c815129030b790a0f5c2715
Author:     Jason Baron <[email protected]>
AuthorDate: Tue, 1 Dec 2009 12:18:49 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 2 Dec 2009 09:57:37 +0100

tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Ug, I need more sleep, because I never noticed the "SINGLE" when I acked this :-p

I thought the DEFINE_SINGLE_EVENT was still under discussion because it is a confusing name. I suggested to call it exactly what is was.

DECLARE_CLASS_AND_DEFINE_EVENT()

-- Steve

Quoted 27 lines

The introduction of the new 'DECLARE_EVENT_CLASS()' obviates the need for the 'TRACE_EVENT()' macro in some cases. Thus, docbook style comments that used to live with 'TRACE_EVENT()' are now moved to 'DEFINE_EVENT()'. Thus, we need to make the docbook system understand the new 'DEFINE_EVENT()' macro. In addition I've tried to futureproof the patch, by also adding support for 'DEFINE_SINGLE_EVENT()', since there has been discussion about
renaming: TRACE_EVENT() -> DEFINE_SINGLE_EVENT().

Without this patch the tracepoint docbook fails to build.

I've verified that this patch correctly builds the tracepoint docbook which currently covers signals, and irqs.

Changes in v2:
- properly indent perl 'if' statements

Cc William Cohen <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Masami Hiramatsu <[email protected]>

LKML-Reference: <200912011718.nB1HIn7t011371@int-mx04.intmail.prod.int.phx2.redhat.com>

#4 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 10 lines · Steven Rostedt
Quoted 8 lines · tip-bot for Jason Baron
Commit-ID:  3a9089fd78367e2c6c815129030b790a0f5c2715
Gitweb:     http://git.kernel.org/tip/3a9089fd78367e2c6c815129030b790a0f5c2715
Author:     Jason Baron <[email protected]>
AuthorDate: Tue, 1 Dec 2009 12:18:49 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 2 Dec 2009 09:57:37 +0100

tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 7 lines

Ug, I need more sleep, because I never noticed the "SINGLE" when I acked this :-p

I thought the DEFINE_SINGLE_EVENT was still under discussion because it is a confusing name. I suggested to call it exactly what is was.

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

hm?

Ingo

maintainer
#5 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 6 lines · Ingo Molnar
Quoted 1 line

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

Quoted 7 lines

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

hm?

I thought about that too, but it actually makes it more confusing. Because, looking at this with a fresh POV, I would think that after I declare a class, I would use DEFINE_CLASS_EVENT with that class.

But that is looking at it out of context. Since the parameters show exactly what is going on, it may be fine.

I really would like to get a comment from somebody not developing tracers but using them. Because I think we are so ingrained in this, that we have lost the outsider's POV.

So, with the above names, this is an example:

DECLARE_EVENT_CLASS(sched_wakeup_template,

        TP_PROTO(struct rq *rq, struct task_struct *p, int success),

        TP_ARGS(rq, p, success),

        TP_STRUCT__entry(
                __array(        char,   comm,   TASK_COMM_LEN   )
                __field(        pid_t,  pid                     )
                __field(        int,    prio                    )
                __field(        int,    success                 )
                __field(        int,    target_cpu              )
        ),

        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
                __entry->success        = success;
                __entry->target_cpu     = task_cpu(p);
        ),

        TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
                  __entry->comm, __entry->pid, __entry->prio,
                  __entry->success, __entry->target_cpu)

);

DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
TP_PROTO(struct rq *rq, struct task_struct *p, int success), TP_ARGS(rq, p, success));

DEFINE_CLASS_EVENT(sched_switch,

        TP_PROTO(struct rq *rq, struct task_struct *prev,
                 struct task_struct *next),

        TP_ARGS(rq, prev, next),

        TP_STRUCT__entry(
                __array(        char,   prev_comm,      TASK_COMM_LEN   )
                __field(        pid_t,  prev_pid                        )
                __field(        int,    prev_prio                       )
                __field(        long,   prev_state                      )
                __array(        char,   next_comm,      TASK_COMM_LEN   )
                __field(        pid_t,  next_pid                        )
                __field(        int,    next_prio                       )
        ),

        TP_fast_assign(
                memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
                __entry->prev_pid       = prev->pid;
                __entry->prev_prio      = prev->prio;
                __entry->prev_state     = prev->state;
                memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
                __entry->next_pid       = next->pid;
                __entry->next_prio      = next->prio;
        ),

        TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_pid=%d next_prio=%d",
                __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
                __entry->prev_state ?
                  __print_flags(__entry->prev_state, "|",
                                { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
                                { 16, "Z" }, { 32, "X" }, { 64, "x" },
                                { 128, "W" }) : "R",
                __entry->next_comm, __entry->next_pid, __entry->next_prio)

);

Anyone have any comments to whether or not the above is good or bad?

-- Steve

#6 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 14 lines · Steven Rostedt
Quoted 12 lines · Ingo Molnar
Quoted 1 line

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

Quoted 5 lines
Quoted 1 line

hm?

I thought about that too, but it actually makes it more confusing. Because, looking at this with a fresh POV, I would think that after I declare a class, I would use DEFINE_CLASS_EVENT with that class.

yeah. Hence was my second-best choice 'DEFINE_STANDALONE_EVENT' or 'DEFINE_SINGLE_EVENT' - to stress the special nature it, and to actually nudge people towards creating classes of events instead of doing separate, standalone points. (which are a waste in the majority of cases)

Ingo

maintainer
#7 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 22 lines · Ingo Molnar
Quoted 14 lines · Steven Rostedt
Quoted 12 lines · Ingo Molnar
Quoted 1 line

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

Quoted 5 lines
Quoted 1 line

hm?

I thought about that too, but it actually makes it more confusing. Because, looking at this with a fresh POV, I would think that after I declare a class, I would use DEFINE_CLASS_EVENT with that class.

Quoted 5 lines

yeah. Hence was my second-best choice 'DEFINE_STANDALONE_EVENT' or 'DEFINE_SINGLE_EVENT' - to stress the special nature it, and to actually nudge people towards creating classes of events instead of doing separate, standalone points. (which are a waste in the majority of cases)

But the current TRACE_EVENT is still defining a class. Thus, you could create a TRACE_EVENT (or whatever it is called) and then create DEFINE_EVENTs based on the TRACE_EVENT.

That's why I want a name that describes this.

DEFINE_EVENT_CLASS?

Perhaps that's the best.

DECLARE_EVENT_CLASS - only creates a class
DEFINE_EVENT - defines an event based off of a class DEFINE_EVENT_CLASS - creates a class and defines an event by the same name

Perhaps this is best in keeping with linux kernel naming conventions?

-- Steve

-- Steve

#8 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 37 lines · On Wed, 02 Dec 2009 09:55:35 -0500 Steven Rostedt wrote:
Quoted 22 lines · Ingo Molnar
Quoted 14 lines · Steven Rostedt
Quoted 12 lines · Ingo Molnar
Quoted 1 line

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

Quoted 5 lines
Quoted 1 line

hm?

I thought about that too, but it actually makes it more confusing. Because, looking at this with a fresh POV, I would think that after I declare a class, I would use DEFINE_CLASS_EVENT with that class.

Quoted 5 lines

yeah. Hence was my second-best choice 'DEFINE_STANDALONE_EVENT' or 'DEFINE_SINGLE_EVENT' - to stress the special nature it, and to actually nudge people towards creating classes of events instead of doing separate, standalone points. (which are a waste in the majority of cases)

But the current TRACE_EVENT is still defining a class. Thus, you could create a TRACE_EVENT (or whatever it is called) and then create DEFINE_EVENTs based on the TRACE_EVENT.

That's why I want a name that describes this.

DEFINE_EVENT_CLASS?

Quoted 7 lines

Perhaps that's the best.

DECLARE_EVENT_CLASS - only creates a class
DEFINE_EVENT - defines an event based off of a class DEFINE_EVENT_CLASS - creates a class and defines an event by the same name

Perhaps this is best in keeping with linux kernel naming conventions?

Yes, that seems fairly typical.

I didn't care for the
DEFINE_x_y()
and
DEFINE_y_x()
suggestion. That just opens the door for confusion IMO.

thanks,
---
~Randy

#9 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

In reply to Steven Rostedt
Quoted 37 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 22 lines · Ingo Molnar
Quoted 14 lines · Steven Rostedt
Quoted 12 lines · Ingo Molnar
Quoted 1 line

DECLARE_CLASS_AND_DEFINE_EVENT()

Hm, that's a bit too long. How about 'DEFINE_CLASS_EVENT()' as a compromise? It's similarly short-ish to TRACE_EVENT(), and it also conveys the fact that we create both a class and an event there.

The full series would thus be:

DECLARE_EVENT_CLASS
DEFINE_EVENT
DEFINE_CLASS_EVENT

Quoted 5 lines
Quoted 1 line

hm?

I thought about that too, but it actually makes it more confusing. Because, looking at this with a fresh POV, I would think that after I declare a class, I would use DEFINE_CLASS_EVENT with that class.

Quoted 5 lines

yeah. Hence was my second-best choice 'DEFINE_STANDALONE_EVENT' or 'DEFINE_SINGLE_EVENT' - to stress the special nature it, and to actually nudge people towards creating classes of events instead of doing separate, standalone points. (which are a waste in the majority of cases)

But the current TRACE_EVENT is still defining a class. Thus, you could create a TRACE_EVENT (or whatever it is called) and then create DEFINE_EVENTs based on the TRACE_EVENT.

That's why I want a name that describes this.

DEFINE_EVENT_CLASS?

Quoted 7 lines

Perhaps that's the best.

DECLARE_EVENT_CLASS - only creates a class
DEFINE_EVENT - defines an event based off of a class DEFINE_EVENT_CLASS - creates a class and defines an event by the same name

Perhaps this is best in keeping with linux kernel naming conventions?

Hi Steve,

A few questions about the semantic:

Is "declare" here always only used as a declaration ? (e.g. only in headers, never impacted by CREATE_TRACE_POINT ?)

Is "define" here always mapping to a definition ? (e.g. to be used in a C file to define the class or event handling stub)

I feel that your DEFINE_EVENT_CLASS might actually be doing a bit more than just "defining", it would actually also perform the declaration. Same goes for "DEFINE_EVENT". So can you tell us a bit more about that is the context of templates ?

Thanks,

Mathieu

Quoted 4 lines

-- Steve

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
maintainer
#10 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 4 lines · Mathieu Desnoyers

A few questions about the semantic:

Is "declare" here always only used as a declaration ? (e.g. only in headers, never impacted by CREATE_TRACE_POINT ?)

Well yes it is impacted by CREATE_TRACE_POINT, but so is DECLARE_TRACE for that matter ;-)

The difference is that DECLARE_EVENT_CLASS will at most (with CREATE_TRACE_POINT) only create the functions that can be used by other events. It does not create an event itself. That is, it's not much different than making a "static inline function" except that function will not be static nor will it be inline ;-)

Quoted 3 lines

Is "define" here always mapping to a definition ? (e.g. to be used in a C file to define the class or event handling stub)

The DEFINE_* will create something that can be hooked to the trace points in other C files.

Quoted 5 lines

I feel that your DEFINE_EVENT_CLASS might actually be doing a bit more than just "defining", it would actually also perform the declaration. Same goes for "DEFINE_EVENT". So can you tell us a bit more about that is the context of templates ?

Well, the macros used by these are totally off the wall anyway :-) So any name we come up with will not match what the rest of the kernel does regardless. But we need to give something that is close.

I'm liking more the:

DECLARE_EVENT_CLASS, DEFINE_EVENT, DEFINE_EVENT_CLASS, because I think that comes the closest to other semantics in the kernel. That is (once again)

DECLARE_EVENT_CLASS - makes only the class. It does create helper functions, but if there's no DEFINE_EVENT that uses them, then they are just wasting space.

The DEFINE_EVENT will create the trace points in the C file that has CREATE_TRACE_POINTS defined. But it requires the helper functions created by a previous DECLARE_EVENT_CLASS.

DEFINE_EVENT_CLASS will do both create a EVENT_CLASS template, as well as a EVENT that uses the class. The name of the class is a separate namespace as the event. Here both the class and the event have the same name, but other events can use this class by referencing the name.

DEFINE_EVENT_CLASS(x, ...);

DEFINE_EVENT(x, y, ...);

The DEFINE_EVENT_CLASS will create a class x and an event x, then the DEFINE_EVENT will create another event y that uses the same class x.

Actually, with the above, we may not need to have DECLARE_EVENT_CLASS() at all, because why declare a class if you don't have an event to use it? But then again, you may not want the name of the class also a name of an event.

-- Steve

#11 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 58 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

A few questions about the semantic:

Is "declare" here always only used as a declaration ? (e.g. only in headers, never impacted by CREATE_TRACE_POINT ?)

Well yes it is impacted by CREATE_TRACE_POINT, but so is DECLARE_TRACE for that matter ;-)

The difference is that DECLARE_EVENT_CLASS will at most (with CREATE_TRACE_POINT) only create the functions that can be used by other events. It does not create an event itself. That is, it's not much different than making a "static inline function" except that function will not be static nor will it be inline ;-)

Quoted 3 lines

Is "define" here always mapping to a definition ? (e.g. to be used in a C file to define the class or event handling stub)

The DEFINE_* will create something that can be hooked to the trace points in other C files.

Quoted 5 lines

I feel that your DEFINE_EVENT_CLASS might actually be doing a bit more than just "defining", it would actually also perform the declaration. Same goes for "DEFINE_EVENT". So can you tell us a bit more about that is the context of templates ?

Well, the macros used by these are totally off the wall anyway :-) So any name we come up with will not match what the rest of the kernel does regardless. But we need to give something that is close.

I'm liking more the:

DECLARE_EVENT_CLASS, DEFINE_EVENT, DEFINE_EVENT_CLASS, because I think that comes the closest to other semantics in the kernel. That is (once again)

DECLARE_EVENT_CLASS - makes only the class. It does create helper functions, but if there's no DEFINE_EVENT that uses them, then they are just wasting space.

The DEFINE_EVENT will create the trace points in the C file that has CREATE_TRACE_POINTS defined. But it requires the helper functions created by a previous DECLARE_EVENT_CLASS.

DEFINE_EVENT_CLASS will do both create a EVENT_CLASS template, as well as a EVENT that uses the class. The name of the class is a separate namespace as the event. Here both the class and the event have the same name, but other events can use this class by referencing the name.

DEFINE_EVENT_CLASS(x, ...);

DEFINE_EVENT(x, y, ...);

Quoted 8 lines

The DEFINE_EVENT_CLASS will create a class x and an event x, then the DEFINE_EVENT will create another event y that uses the same class x.

Actually, with the above, we may not need to have DECLARE_EVENT_CLASS() at all, because why declare a class if you don't have an event to use it? But then again, you may not want the name of the class also a name of an event.

Hrm. I wonder if having DEFINE_EVENT_CLASS is really worth having, considering that it really just does 2 things at once and may be confusing.

I would have thought amongst the lines of the following as main API (note: "SKETCH" is only a proposal. The idea is to do _not_ use declare/define, as it's really something _different_ than what people are expecting!)

SKETCH_EVENT_CLASS()

SKETCH_EVENT()

Which would use only DECLARE, or both DECLARE and DEFINE depending if CREATE_TRACE_POINTS is set. I see the DECLARE/DEFINE more as the "low-level" macros that are actually selected by CREATE_TRACE_POINTS:

DECLARE_EVENT_CLASS : only performs event class declarations (macros, inlines...)

DECLARE_EVENT : only performs event instance declarations (macros, inlines, ...). Depends on the DECLARE_EVENT_CLASS().

DEFINE_EVENT_CLASS : create instances of template functions.

DEFINE_EVENT : create event tracepoint functions. Depends on DEFINE_EVENT_CLASS().

This way, it should make digging into the generation system internals headhache-free. ;) I think we should really avoid re-using terms people are familiar with for things that have a semantic intrincially different than what people come to expect.

Mathieu

Quoted 4 lines

-- Steve

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
maintainer
#12 lore raw

Re: [tip:perf/core] tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook

Quoted 4 lines · Mathieu Desnoyers

*
Hrm. I wonder if having DEFINE_EVENT_CLASS is really worth having, considering that it really just does 2 things at once and may be confusing.

We keep it because that's what TRACE_EVENT currently is. It would suck to have to replace every TRACE_EVENT there is now with a DECLARE_EVENT_CLASS and DEFINE_EVENT. Although this would push developers into using classes.

Quoted 22 lines

I would have thought amongst the lines of the following as main API (note: "SKETCH" is only a proposal. The idea is to do _not_ use declare/define, as it's really something _different_ than what people are expecting!)

SKETCH_EVENT_CLASS()

SKETCH_EVENT()

Which would use only DECLARE, or both DECLARE and DEFINE depending if CREATE_TRACE_POINTS is set. I see the DECLARE/DEFINE more as the "low-level" macros that are actually selected by CREATE_TRACE_POINTS:

DECLARE_EVENT_CLASS : only performs event class declarations (macros, inlines...)

DECLARE_EVENT : only performs event instance declarations (macros, inlines, ...). Depends on the DECLARE_EVENT_CLASS().

DEFINE_EVENT_CLASS : create instances of template functions.

Quoted 7 lines

DEFINE_EVENT : create event tracepoint functions. Depends on DEFINE_EVENT_CLASS().

This way, it should make digging into the generation system internals headhache-free. ;) I think we should really avoid re-using terms people are familiar with for things that have a semantic intrincially different than what people come to expect.

Egad No! It would make it a living nightmare. The internals reuse the define macro, and there's no intermediate. By changing the DECLARE_EVENT_CLASS to another name (SKETCH_EVENT_CLASS) we would have to add something like this:

#define SKETCH_EVENT_CLASS(name, proto, args, tstruct, print) \
	DECLARE_EVENT_CLASS(name, PARAMS(proto), PARAMS(args),\
		PARAMS(tstruct), PARAMS(print))

We don't have a intermediate or "low level" macro in use here. Whatever we give to the user is what we use.

I think the kernel developers are smart enough to figure out that these macros are not a typical DECLARE/DEFINE that is elsewhere. But I think using the DECLARE/DEFINE names will give them a better idea of what is happening than to make up something completely new.

-- Steve

#13 lore raw

trace/events: DECLARE vs DEFINE semantic

Quoted 10 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

*
Hrm. I wonder if having DEFINE_EVENT_CLASS is really worth having, considering that it really just does 2 things at once and may be confusing.

We keep it because that's what TRACE_EVENT currently is. It would suck to have to replace every TRACE_EVENT there is now with a DECLARE_EVENT_CLASS and DEFINE_EVENT. Although this would push developers into using classes.

I agree that keeping something for backward compatibility is good, but what I dislike the most is the similarity between the DECLARE_EVENT_CLASS and DEFINE_EVENT_CLASS which have completely unrelated semantics. This is really misleading.

Quoted 36 lines
Quoted 23 lines

I would have thought amongst the lines of the following as main API (note: "SKETCH" is only a proposal. The idea is to do _not_ use declare/define, as it's really something _different_ than what people are expecting!)

SKETCH_EVENT_CLASS()

SKETCH_EVENT()

Which would use only DECLARE, or both DECLARE and DEFINE depending if CREATE_TRACE_POINTS is set. I see the DECLARE/DEFINE more as the "low-level" macros that are actually selected by CREATE_TRACE_POINTS:

DECLARE_EVENT_CLASS : only performs event class declarations (macros, inlines...)

DECLARE_EVENT : only performs event instance declarations (macros, inlines, ...). Depends on the DECLARE_EVENT_CLASS().

DEFINE_EVENT_CLASS : create instances of template functions.

Quoted 7 lines

DEFINE_EVENT : create event tracepoint functions. Depends on DEFINE_EVENT_CLASS().

This way, it should make digging into the generation system internals headhache-free. ;) I think we should really avoid re-using terms people are familiar with for things that have a semantic intrincially different than what people come to expect.

Egad No! It would make it a living nightmare. The internals reuse the define macro, and there's no intermediate. By changing the DECLARE_EVENT_CLASS to another name (SKETCH_EVENT_CLASS) we would have to add something like this:

Quoted 7 lines
#define SKETCH_EVENT_CLASS(name, proto, args, tstruct, print) \
	DECLARE_EVENT_CLASS(name, PARAMS(proto), PARAMS(args),\
		PARAMS(tstruct), PARAMS(print))

We don't have a intermediate or "low level" macro in use here. Whatever we give to the user is what we use.

Maybe we should consider having one. e.g.:

#ifdef CREATE_TRACE_POINTS

SKETCH_EVENT_CLASS maps to DEFINE_EVENT_CLASS

#else

SKETCH_EVENT_CLASS maps to DECLARE_EVENT_CLASS

#endif

Quoted 5 lines

I think the kernel developers are smart enough to figure out that these macros are not a typical DECLARE/DEFINE that is elsewhere. But I think using the DECLARE/DEFINE names will give them a better idea of what is happening than to make up something completely new.

In my opinion, re-using a well-known keyword (e.g. DECLARE/DEFINE) but applying a different semantic to what is generally agreed upon is a recipe for confusing developers and users, who will skip the review of some pieces of code assuming they already know what "DECLARE" and "DEFINE" stands for.

I argue here that the content of trace/events/ headers are _not_ per se declarations nor definitions, and hence they should not confuse people by using inappropriately well-known keywords. They are actually more evolved macros that can be turned in either a declaration or definition, depending if CREATE_TRACE_POINTS is declared.

When I created the markers/tracepoints, Andrew Morton explained to me the importance of distinguishing DECLARE vs DEFINE macros. I would really like to hear his point of view on the current question.

Thanks,

Mathieu

Quoted 3 lines

-- Steve

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
maintainer
#14 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 12 lines · Mathieu Desnoyers
Quoted 10 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

*
Hrm. I wonder if having DEFINE_EVENT_CLASS is really worth having, considering that it really just does 2 things at once and may be confusing.

We keep it because that's what TRACE_EVENT currently is. It would suck to have to replace every TRACE_EVENT there is now with a DECLARE_EVENT_CLASS and DEFINE_EVENT. Although this would push developers into using classes.

Quoted 4 lines

I agree that keeping something for backward compatibility is good, but what I dislike the most is the similarity between the DECLARE_EVENT_CLASS and DEFINE_EVENT_CLASS which have completely unrelated semantics. This is really misleading.

Not really, they are almost identical. But one creates an event with the class, whereas the other does not. I find this quite convenient.

Quoted 18 lines
Quoted 6 lines

Egad No! It would make it a living nightmare. The internals reuse the define macro, and there's no intermediate. By changing the DECLARE_EVENT_CLASS to another name (SKETCH_EVENT_CLASS) we would have to add something like this:

Quoted 7 lines
#define SKETCH_EVENT_CLASS(name, proto, args, tstruct, print) \
	DECLARE_EVENT_CLASS(name, PARAMS(proto), PARAMS(args),\
		PARAMS(tstruct), PARAMS(print))

We don't have a intermediate or "low level" macro in use here. Whatever we give to the user is what we use.

Maybe we should consider having one. e.g.:

#ifdef CREATE_TRACE_POINTS

Quoted 7 lines

SKETCH_EVENT_CLASS maps to DEFINE_EVENT_CLASS

#else

SKETCH_EVENT_CLASS maps to DECLARE_EVENT_CLASS

#endif

And what? Make another level of needless abstraction? That's sure to not confuse people.

Quoted 13 lines
Quoted 6 lines

I think the kernel developers are smart enough to figure out that these macros are not a typical DECLARE/DEFINE that is elsewhere. But I think using the DECLARE/DEFINE names will give them a better idea of what is happening than to make up something completely new.

In my opinion, re-using a well-known keyword (e.g. DECLARE/DEFINE) but applying a different semantic to what is generally agreed upon is a recipe for confusing developers and users, who will skip the review of some pieces of code assuming they already know what "DECLARE" and "DEFINE" stands for.

Quoted 5 lines

I argue here that the content of trace/events/ headers are _not_ per se declarations nor definitions, and hence they should not confuse people by using inappropriately well-known keywords. They are actually more evolved macros that can be turned in either a declaration or definition, depending if CREATE_TRACE_POINTS is declared.

And I argue that the semantics here are not too far off to what those are. Yes, these macros behave differently if CREATE_TRACE_POINTS is declared or not, but I argue that the average (and below average) kernel developer is smart enough to understand this difference.

Quoted 4 lines

When I created the markers/tracepoints, Andrew Morton explained to me the importance of distinguishing DECLARE vs DEFINE macros. I would really like to hear his point of view on the current question.

I would like to hear Andrew's comments too, as well as anyone else. Randy Dunlap seemed to already approve of these naming conventions, and he's a pretty picky person too.

Randy, do you agree that the use of DECLARE/DEFINE here is fine, or do you think that we should come up with a better naming. I do not want to add any needless abstraction layer for the sake of naming. These macros are confusing enough without that.

Or do you (or anyone else) have a better name?

-- Steve

#15 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 80 lines · On Wed, 02 Dec 2009 14:19:38 -0500 Steven Rostedt wrote:
Quoted 12 lines · Mathieu Desnoyers
Quoted 10 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

*
Hrm. I wonder if having DEFINE_EVENT_CLASS is really worth having, considering that it really just does 2 things at once and may be confusing.

We keep it because that's what TRACE_EVENT currently is. It would suck to have to replace every TRACE_EVENT there is now with a DECLARE_EVENT_CLASS and DEFINE_EVENT. Although this would push developers into using classes.

Quoted 4 lines

I agree that keeping something for backward compatibility is good, but what I dislike the most is the similarity between the DECLARE_EVENT_CLASS and DEFINE_EVENT_CLASS which have completely unrelated semantics. This is really misleading.

Not really, they are almost identical. But one creates an event with the class, whereas the other does not. I find this quite convenient.

Quoted 18 lines
Quoted 6 lines

Egad No! It would make it a living nightmare. The internals reuse the define macro, and there's no intermediate. By changing the DECLARE_EVENT_CLASS to another name (SKETCH_EVENT_CLASS) we would have to add something like this:

Quoted 7 lines
#define SKETCH_EVENT_CLASS(name, proto, args, tstruct, print) \
	DECLARE_EVENT_CLASS(name, PARAMS(proto), PARAMS(args),\
		PARAMS(tstruct), PARAMS(print))

We don't have a intermediate or "low level" macro in use here. Whatever we give to the user is what we use.

Maybe we should consider having one. e.g.:

#ifdef CREATE_TRACE_POINTS

Quoted 7 lines

SKETCH_EVENT_CLASS maps to DEFINE_EVENT_CLASS

#else

SKETCH_EVENT_CLASS maps to DECLARE_EVENT_CLASS

#endif

And what? Make another level of needless abstraction? That's sure to not confuse people.

Quoted 13 lines
Quoted 6 lines

I think the kernel developers are smart enough to figure out that these macros are not a typical DECLARE/DEFINE that is elsewhere. But I think using the DECLARE/DEFINE names will give them a better idea of what is happening than to make up something completely new.

In my opinion, re-using a well-known keyword (e.g. DECLARE/DEFINE) but applying a different semantic to what is generally agreed upon is a recipe for confusing developers and users, who will skip the review of some pieces of code assuming they already know what "DECLARE" and "DEFINE" stands for.

Quoted 5 lines

I argue here that the content of trace/events/ headers are _not_ per se declarations nor definitions, and hence they should not confuse people by using inappropriately well-known keywords. They are actually more evolved macros that can be turned in either a declaration or definition, depending if CREATE_TRACE_POINTS is declared.

And I argue that the semantics here are not too far off to what those are. Yes, these macros behave differently if CREATE_TRACE_POINTS is declared or not, but I argue that the average (and below average) kernel developer is smart enough to understand this difference.

Quoted 4 lines

When I created the markers/tracepoints, Andrew Morton explained to me the importance of distinguishing DECLARE vs DEFINE macros. I would really like to hear his point of view on the current question.

Quoted 8 lines

I would like to hear Andrew's comments too, as well as anyone else. Randy Dunlap seemed to already approve of these naming conventions, and he's a pretty picky person too.

Randy, do you agree that the use of DECLARE/DEFINE here is fine, or do you think that we should come up with a better naming. I do not want to add any needless abstraction layer for the sake of naming. These macros are confusing enough without that.

Yes, that's what I would expect to see used, although I haven't been following this with the same level of detail that Mathieu has been.

Hopefully Andrew can chime in here also.

Quoted 1 line

Or do you (or anyone else) have a better name?

---
~Randy

#16 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

In reply to Steven Rostedt
Quoted 32 lines · Steven Rostedt
Quoted 11 lines
Quoted 4 lines

I think the kernel developers are smart enough to figure out that these macros are not a typical DECLARE/DEFINE that is elsewhere. But I think using the DECLARE/DEFINE names will give them a better idea of what is happening than to make up something completely new.

In my opinion, re-using a well-known keyword (e.g. DECLARE/DEFINE) but applying a different semantic to what is generally agreed upon is a recipe for confusing developers and users, who will skip the review of some pieces of code assuming they already know what "DECLARE" and "DEFINE" stands for.

Quoted 5 lines

I argue here that the content of trace/events/ headers are _not_ per se declarations nor definitions, and hence they should not confuse people by using inappropriately well-known keywords. They are actually more evolved macros that can be turned in either a declaration or definition, depending if CREATE_TRACE_POINTS is declared.

And I argue that the semantics here are not too far off to what those are. Yes, these macros behave differently if CREATE_TRACE_POINTS is declared or not, but I argue that the average (and below average) kernel developer is smart enough to understand this difference.

Quoted 4 lines

When I created the markers/tracepoints, Andrew Morton explained to me the importance of distinguishing DECLARE vs DEFINE macros. I would really like to hear his point of view on the current question.

I would like to hear Andrew's comments too, as well as anyone else. Randy Dunlap seemed to already approve of these naming conventions, and he's a pretty picky person too.

Quoted 6 lines

Randy, do you agree that the use of DECLARE/DEFINE here is fine, or do you think that we should come up with a better naming. I do not want to add any needless abstraction layer for the sake of naming. These macros are confusing enough without that.

Or do you (or anyone else) have a better name?

How about renaming DEFINE_EVENT to TRACE_EVENT_CLASS?

DECLARE_EVENT_CLASS(y, ...) declare an event-class y
TRACE_EVENT_CLASS(x, y, ...) define/declare a trace event x from event-class y
TRACE_EVENT(x, ...) define/declare a trace event x

Thus TRACE_EVENT_* implies that this macro will be expanded to both of definition and declaration.
I don't think separating it is good idea from the viewpoint of maintaining code.

Thank you,

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
maintainer
#17 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 4 lines · Masami Hiramatsu
Quoted 1 line

Or do you (or anyone else) have a better name?

How about renaming DEFINE_EVENT to TRACE_EVENT_CLASS?

Quoted 8 lines

DECLARE_EVENT_CLASS(y, ...) declare an event-class y
TRACE_EVENT_CLASS(x, y, ...) define/declare a trace event x from event-class y
TRACE_EVENT(x, ...) define/declare a trace event x

Thus TRACE_EVENT_* implies that this macro will be expanded to both of definition and declaration.
I don't think separating it is good idea from the viewpoint of maintaining code.

Hmm, what about just:

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

-- Steve

#18 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 15 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Masami Hiramatsu
Quoted 1 line

Or do you (or anyone else) have a better name?

How about renaming DEFINE_EVENT to TRACE_EVENT_CLASS?

Quoted 8 lines

DECLARE_EVENT_CLASS(y, ...) declare an event-class y
TRACE_EVENT_CLASS(x, y, ...) define/declare a trace event x from event-class y
TRACE_EVENT(x, ...) define/declare a trace event x

Thus TRACE_EVENT_* implies that this macro will be expanded to both of definition and declaration.
I don't think separating it is good idea from the viewpoint of maintaining code.

Quoted 5 lines

Hmm, what about just:

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

Yep, it looks good! It's self-descriptive and don't require to explain what the thing is doing each time we refer to it. (however I feel a bit sad for Fred, Wilma and Barney) ;)

For that semantic, you have my

Thanks,

Mathieu

Quoted 4 lines

-- Steve

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#19 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 9 lines · Mathieu Desnoyers
Quoted 4 lines

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

Yep, it looks good! It's self-descriptive and don't require to explain what the thing is doing each time we refer to it. (however I feel a bit sad for Fred, Wilma and Barney) ;)

Although you have to admit it's a bit confusing that:

TRACE_EVENT = TRACE_CLASS + TRACE_CLASS_EVENT

... as opposed to ...

TRACE_CLASS_EVENT = TRACE_CLASS + TRACE_EVENT

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
maintainer
#20 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 11 lines · H. Peter Anvin
Quoted 9 lines · Mathieu Desnoyers
Quoted 4 lines

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

Yep, it looks good! It's self-descriptive and don't require to explain what the thing is doing each time we refer to it. (however I feel a bit sad for Fred, Wilma and Barney) ;)

Quoted 7 lines

Although you have to admit it's a bit confusing that:

TRACE_EVENT = TRACE_CLASS + TRACE_CLASS_EVENT

... as opposed to ...

TRACE_CLASS_EVENT = TRACE_CLASS + TRACE_EVENT

Fred, Wilma and Barney are sounding better by the second.

So, would you think:

TRACE_CLASS - Declare a class
TRACE_EVENT - defines an event for said class (different meaning than before) TRACE_CLASS_EVENT - Declares a class and an event

is the better naming?

-- Steve

#21 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 9 lines · Steven Rostedt

So, would you think:

TRACE_CLASS - Declare a class
TRACE_EVENT - defines an event for said class (different meaning than before) TRACE_CLASS_EVENT - Declares a class and an event

is the better naming?

Minus the legacy issue, yes.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#22 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

In reply to H. Peter Anvin
Quoted 13 lines · * H. Peter Anvin ([email protected]) wrote:
Quoted 9 lines · Mathieu Desnoyers
Quoted 4 lines

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

Yep, it looks good! It's self-descriptive and don't require to explain what the thing is doing each time we refer to it. (however I feel a bit sad for Fred, Wilma and Barney) ;)

Although you have to admit it's a bit confusing that:

Quoted 7 lines

TRACE_EVENT = TRACE_CLASS + TRACE_CLASS_EVENT

... as opposed to ...

TRACE_CLASS_EVENT = TRACE_CLASS + TRACE_EVENT

-hpa

Then I would say that TRACE_EVENT should probably not have the side-effect of declaring a globally-reuseable class. Maybe under the hood it could create a privately-named class, but I don't see how it can be re-used by following TRACE_CLASS_EVENT without causing confusion.

I'd go for:

TRACE_CLASS - Declares/defines a class
TRACE_CLASS_EVENT - Declares/defines an event for said class TRACE_EVENT - Declares/defines a private class and declares/defines an event

Mathieu

Quoted 5 lines
Signature · 3 lines
-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#23 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 27 lines · Mathieu Desnoyers
Quoted 13 lines · * H. Peter Anvin ([email protected]) wrote:
Quoted 9 lines · Mathieu Desnoyers
Quoted 4 lines

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

Yep, it looks good! It's self-descriptive and don't require to explain what the thing is doing each time we refer to it. (however I feel a bit sad for Fred, Wilma and Barney) ;)

Although you have to admit it's a bit confusing that:

Quoted 7 lines

TRACE_EVENT = TRACE_CLASS + TRACE_CLASS_EVENT

... as opposed to ...

TRACE_CLASS_EVENT = TRACE_CLASS + TRACE_EVENT

-hpa

Then I would say that TRACE_EVENT should probably not have the side-effect of declaring a globally-reuseable class. Maybe under the hood it could create a privately-named class, but I don't see how it can be re-used by following TRACE_CLASS_EVENT without causing confusion.

Quoted 5 lines

I'd go for:

TRACE_CLASS - Declares/defines a class
TRACE_CLASS_EVENT - Declares/defines an event for said class TRACE_EVENT - Declares/defines a private class and declares/defines an event

Agreed, I'd rather like this naming. :-)

Thank you!

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
#24 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

In reply to Steven Rostedt
Quoted 15 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 4 lines · Masami Hiramatsu
Quoted 1 line

Or do you (or anyone else) have a better name?

How about renaming DEFINE_EVENT to TRACE_EVENT_CLASS?

Quoted 8 lines

DECLARE_EVENT_CLASS(y, ...) declare an event-class y
TRACE_EVENT_CLASS(x, y, ...) define/declare a trace event x from event-class y
TRACE_EVENT(x, ...) define/declare a trace event x

Thus TRACE_EVENT_* implies that this macro will be expanded to both of definition and declaration.
I don't think separating it is good idea from the viewpoint of maintaining code.

Quoted 5 lines

Hmm, what about just:

TRACE_CLASS - Declares a class
TRACE_CLASS_EVENT - defines an event for said class TRACE_EVENT - Declares a class and defines an event (as is today)

In addition, I wonder if we should rename "CREATE_TRACE_POINTS" to something more suitable while we are here ? Basically, it will affect all TRACE_CLASS/TRACE_CLASS_EVENT/TRACE_EVENT from headers included after it's defined.

It sounds to me that this "CREATE_TRACE_POINTS" is the define that controls whether the TRACE_* will actually turn into a DECLARE or a DEFINE. I agree that the standard behavior should be to "DECLARE" stuff, as it's the, by far, most common case, but maybe

#define TRACE_DEFINE
#include <trace/events/....h>

would be more descriptive than "CREATE_TRACE_POINTS", given it refers to the well-known "define" semantic ?

So if we happen to have C file which need many headers to be declared but only some of them to be defined, we could express it as:

#include <trace/events/sched.h>
#include <trace/events/irq.h>
#include <trace/events/timer.h>

#define TRACE_DEFINE
#include <trace/events/irq.h>
#include <trace/events/timer.h>
#undef TRACE_DEFINE

That would imply that any definition of a trace event header should be preceded by an inclusion of this same header to perform the declaration. This would clearly separate the declaration from definition.

Does it make sense ?

Mathieu

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#25 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 4 lines · Mathieu Desnoyers

In addition, I wonder if we should rename "CREATE_TRACE_POINTS" to something more suitable while we are here ? Basically, it will affect all TRACE_CLASS/TRACE_CLASS_EVENT/TRACE_EVENT from headers included after it's defined.

Agreed, CREATE_TRACE_POINTS is a bit irritating thing :-(

For example, if we call tracepoints defined in same-header on several different files, we need to check other people have already defined CREATE_TRACE_POINTS on another file, because CREATE_TRACE_POINTS must be used once for each header...

So, how about introducing a c file which is only for defining tracepoints for kernel parts ? or defining tracepoints in kernel at the beginning of kernel/tracepoint.c ? (and don't touch tracepoints in modules)

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>
...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>
...

Hmm?

Thank you,

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
maintainer
#26 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 7 lines · Masami Hiramatsu
Quoted 4 lines · Mathieu Desnoyers

In addition, I wonder if we should rename "CREATE_TRACE_POINTS" to something more suitable while we are here ? Basically, it will affect all TRACE_CLASS/TRACE_CLASS_EVENT/TRACE_EVENT from headers included after it's defined.

Agreed, CREATE_TRACE_POINTS is a bit irritating thing :-(

Well, I think the name could use some help, but I don't think it is the name that irritates you.

Quoted 10 lines

For example, if we call tracepoints defined in same-header on several different files, we need to check other people have already defined CREATE_TRACE_POINTS on another file, because CREATE_TRACE_POINTS must be used once for each header...

So, how about introducing a c file which is only for defining tracepoints for kernel parts ? or defining tracepoints in kernel at the beginning of kernel/tracepoint.c ? (and don't touch tracepoints in modules)

I think the proper fix is to have each tracepoint header have its own C file. I believe Christoph does this with xfs.

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

And the same goes for other trace points.

Quoted 8 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 11 lines

...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Quoted 3 lines

...

Hmm?

Hrmmm?

-- Steve

#27 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 11 lines · Steven Rostedt
Quoted 7 lines · Masami Hiramatsu
Quoted 4 lines · Mathieu Desnoyers

In addition, I wonder if we should rename "CREATE_TRACE_POINTS" to something more suitable while we are here ? Basically, it will affect all TRACE_CLASS/TRACE_CLASS_EVENT/TRACE_EVENT from headers included after it's defined.

Agreed, CREATE_TRACE_POINTS is a bit irritating thing :-(

Well, I think the name could use some help, but I don't think it is the name that irritates you.

Yes :-)

Quoted 13 lines
Quoted 9 lines

For example, if we call tracepoints defined in same-header on several different files, we need to check other people have already defined CREATE_TRACE_POINTS on another file, because CREATE_TRACE_POINTS must be used once for each header...

So, how about introducing a c file which is only for defining tracepoints for kernel parts ? or defining tracepoints in kernel at the beginning of kernel/tracepoint.c ? (and don't touch tracepoints in modules)

I think the proper fix is to have each tracepoint header have its own C file. I believe Christoph does this with xfs.

Quoted 6 lines

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

And the same goes for other trace points.

Hmm, I'd rather like to move it into kernel/events/ or something new sub directory, since those files will have just two lines (define and include).

Quoted 17 lines
Quoted 7 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 7 lines

...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

Quoted 7 lines
Quoted 4 lines

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Thank you,

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
maintainer
#28 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 10 lines · Masami Hiramatsu
Quoted 6 lines

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

And the same goes for other trace points.

Hmm, I'd rather like to move it into kernel/events/ or something new sub directory, since those files will have just two lines (define and include).

I'm fine with a kernel/events dir.

Quoted 23 lines
Quoted 23 lines
Quoted 8 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 11 lines

...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>

Quoted 8 lines
Quoted 2 lines

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Why? Modules usually do have their own headers in their sub system.

OK, if a module keeps their headers global (include/linux) then sure they can keep their tracepoint header in include/trace/events. But I still think that the module CREATE_TRACE_POINTS code should be kept with the module code itself (but in a small separate file).

-- Steve

#29 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 7 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 5 lines · Masami Hiramatsu
Quoted 5 lines

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

And the same goes for other trace points.

Hmm, I'd rather like to move it into kernel/events/ or something new sub directory, since those files will have just two lines (define and include).

I'm fine with a kernel/events dir.

Yep, sounds fine.

Maybe we could have separate files for:

a) event definitions
b) class definitions

?

Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
Quoted 9 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 11 lines

...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>

Quoted 8 lines
Quoted 2 lines

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Quoted 6 lines

Why? Modules usually do have their own headers in their sub system.

OK, if a module keeps their headers global (include/linux) then sure they can keep their tracepoint header in include/trace/events. But I still think that the module CREATE_TRACE_POINTS code should be kept with the module code itself (but in a small separate file).

I agree with Steven here: modules should come with their own trace event definitions, and if the trace classes they use are not available in the standard kernel, they should come with these trace classes definitions too.

A small *_trace.c file linked along with the module looks fine by me.

And please, try to re-used the already existing symbol dependency management already present in the kernel to deal with module dependency on class and dependency such as:

module-a.ko
defines trace class
module-b.ko
module-c.ko

module-b and module-c define events which depend on the trace class.

If you make the event definition depend on a symbol defined in module-a, everything should work flawlessly. It also works if the class is defined in the core kernel.

Thanks,

Mathieu

Quoted 4 lines

-- Steve

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
maintainer
#30 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 14 lines · Mathieu Desnoyers
Quoted 13 lines · * Steven Rostedt ([email protected]) wrote:
Quoted 10 lines · Masami Hiramatsu
Quoted 6 lines

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

And the same goes for other trace points.

Hmm, I'd rather like to move it into kernel/events/ or something new sub directory, since those files will have just two lines (define and include).

Quoted 8 lines
Quoted 1 line

I'm fine with a kernel/events dir.

Yep, sounds fine.

Maybe we could have separate files for:

a) event definitions
b) class definitions

Um, because we don't add classes nor definitions for that matter in C files. These files will just have:

#define CREATE_TRACE_POINT
#include <trace/event/x.h>
#include <trace/event/y.h>
[...]

Quoted 59 lines

?

Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
Quoted 9 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
#include <trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 11 lines

...

@kernel/sched.c
...
#include <trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS
#include <trace/events/ext4.h>

Quoted 8 lines
Quoted 2 lines

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Quoted 6 lines

Why? Modules usually do have their own headers in their sub system.

OK, if a module keeps their headers global (include/linux) then sure they can keep their tracepoint header in include/trace/events. But I still think that the module CREATE_TRACE_POINTS code should be kept with the module code itself (but in a small separate file).

I agree with Steven here: modules should come with their own trace event definitions, and if the trace classes they use are not available in the standard kernel, they should come with these trace classes definitions too.

A small *_trace.c file linked along with the module looks fine by me.

And please, try to re-used the already existing symbol dependency management already present in the kernel to deal with module dependency on class and dependency such as:

module-a.ko
defines trace class
module-b.ko
module-c.ko

Quoted 5 lines

module-b and module-c define events which depend on the trace class.

If you make the event definition depend on a symbol defined in module-a, everything should work flawlessly. It also works if the class is defined in the core kernel.

I think the issue is where to find the headers.

But this does bring up another point. I don't think I designed the class macro to be used by events in other headers. Looking at the code, since all the shared functions are "static" it wont work.

I guess I can modify it to be global, and also export them as GPL.

-- Steve

-- Steve

#31 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 1 line · * Steven Rostedt ([email protected]) wrote:

On Thu, 2009-12-03 at 09:09 -0500, Mathieu Desnoyers wrote:

[...]

Quoted 14 lines
Quoted 4 lines

Maybe we could have separate files for:

a) event definitions
b) class definitions

Um, because we don't add classes nor definitions for that matter in C files. These files will just have:

#define CREATE_TRACE_POINT
#include <trace/event/x.h>
#include <trace/event/y.h>
[...]

[...]

Quoted 22 lines
Quoted 16 lines

I agree with Steven here: modules should come with their own trace event definitions, and if the trace classes they use are not available in the standard kernel, they should come with these trace classes definitions too.

A small *_trace.c file linked along with the module looks fine by me.

And please, try to re-used the already existing symbol dependency management already present in the kernel to deal with module dependency on class and dependency such as:

module-a.ko
defines trace class
module-b.ko
module-c.ko

Quoted 5 lines

module-b and module-c define events which depend on the trace class.

If you make the event definition depend on a symbol defined in module-a, everything should work flawlessly. It also works if the class is defined in the core kernel.

Quoted 7 lines

I think the issue is where to find the headers.

But this does bring up another point. I don't think I designed the class macro to be used by events in other headers. Looking at the code, since all the shared functions are "static" it wont work.

I guess I can modify it to be global, and also export them as GPL.

In that case maybe it would become appropriate to extract the TRACE_CLASS() macros meant to be used by many headers into their own

include/trace/class/*.h

headers ?

And then it starts to make sense to have separate C files for event and class definitions.

Mathieu

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#32 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

In reply to Steven Rostedt
Quoted 41 lines · Steven Rostedt
Quoted 10 lines · Masami Hiramatsu
Quoted 6 lines

Basically, we should have a:

kernel/sched_trace.c that includes the include/trace/events/sched.h and does the define.

And the same goes for other trace points.

Hmm, I'd rather like to move it into kernel/events/ or something new sub directory, since those files will have just two lines (define and include).

I'm fine with a kernel/events dir.

Quoted 26 lines
Quoted 25 lines
Quoted 8 lines

e.g.

@kernel/tracepoint.c
...
#define CREATE_TRACE_POINTS
#include<trace/events/sched.h>
#include<trace/events/...>

We could do this for all that is defined in the include/trace/events.

Quoted 11 lines

...

@kernel/sched.c
...
#include<trace/events/sched.h> /* Just include events header */
...

@fs/ext4/super.c (no change, since it can be module)
...
#define CREATE_TRACE_POINTS #include<trace/events/ext4.h>

Perhaps we should move out anything in include/trace/events that is also a module into its sub system?

Quoted 7 lines
Quoted 5 lines

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Why? Modules usually do have their own headers in their sub system.

Module's local headers usually uses only from itself. Other modules may not touch it. However, AFAIK, event definitions must be referred by event consumer which is another module. IOW, those local headers will not be included in kernel-headers/kernel-devel package :-(

Quoted 4 lines

OK, if a module keeps their headers global (include/linux) then sure they can keep their tracepoint header in include/trace/events. But I still think that the module CREATE_TRACE_POINTS code should be kept with the module code itself (but in a small separate file).

Yeah, that's reasonable. :-)

Thank you,

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
maintainer
#33 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 8 lines · Masami Hiramatsu
Quoted 6 lines · Steven Rostedt
Quoted 5 lines

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Quoted 6 lines
Quoted 1 line

Why? Modules usually do have their own headers in their sub system.

Module's local headers usually uses only from itself. Other modules may not touch it. However, AFAIK, event definitions must be referred by event consumer which is another module. IOW, those local headers will not be included in kernel-headers/kernel-devel package :-(

I'm a little confused. Who is the event consumer? The trace point user? The one that hooks into the tracepoint?

-- Steve

#34 lore raw

Re: trace/events: DECLARE vs DEFINE semantic

Quoted 11 lines · Steven Rostedt
Quoted 10 lines · Masami Hiramatsu
Quoted 7 lines · Steven Rostedt
Quoted 5 lines

Would you mean putting those headers in sub-system's directory? (e.g. fs/ext4/)
In that case, a problem will happen when user want to hook those tracepoint from their module, because it is hard to find those local headers.

Why? Modules usually do have their own headers in their sub system.

Quoted 7 lines
Quoted 4 lines

Module's local headers usually uses only from itself. Other modules may not touch it. However, AFAIK, event definitions must be referred by event consumer which is another module. IOW, those local headers will not be included in kernel-headers/kernel-devel package :-(

I'm a little confused. Who is the event consumer? The trace point user? The one that hooks into the tracepoint?

Ah, I meant the tracepoint user module, not the ftrace event consumer.

Thank you,

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
maintainer
#35 lore raw

PATCH 1/1 tracing: Rename TRACE_EVENT and others to something resonable

In reply to Mathieu Desnoyers

With the addition of TRACE_EVENT templates (or classes) the issue of naming has come up.

Originally, the template was called TRACE_EVENT_TEMPLATE. This was to be used to consolidate similar TRACE_EVENTs because a single TRACE_EVENT takes up quite a bit of code. One TRACE_EVENT creates a function to register and unregister a trace point, a function to record the event in a buffer, a function to display the binary output to user space, a function to add counters to record the number of times the event is reached, and so on.

All these functions creates a lot of bloat, especially since these functions are almost identical to each other. Unfortunately, these functions require specific parameters and structure fields, and can't always be the same. But for those events that share the same structure and parameters, a class/template allows them to share the same functions and this cuts down the bloat substantially.

But what to call these macros to satisfy the already confused kernel developers?

Ideally, DECLARE_EVENT_CLASS to create the class, DEFINE_EVENT to create an instance of the class, and even DEFINE_EVENT_CLASS to replace the current TRACE_EVENT that defines a class and creates an event of the same name as the class. New DEFINE_EVENTs may also reference a class declared by DEFINE_EVENT_CLASS.

But us kernel developers stay up too late at night, drinking jolt (or beer if you are in Europe), and our brain cells have fused to only logical circuitry, thus understanding concepts that are not engraved in stone becomes a bit too straining for us, and we may finally have to give up on solving this one last bug to get some rest with our love one that's been sleeping since 9pm.

This means using DECLARE_* and DEFINE_* will push us over that brink to normalcy and must be avoided. A new name must be established to clearly describe the mystical CPP magic that comprises the TRACE_EVENT hackery. Something that can bring us back to our roots. Something where it all begins. The stone age.

Thus, this patch renames the MACROS to the most obvious definitions around. Something we should have thought of at the start.

s/DEFINE_EVENT_CLASS/FRED/g
s/DEFINE_EVENT/WILMA/g
s/TRACE_EVENT/BARNEY/g

Thus with the new naming convention:

FRED(x, ...) -- will declare a class but will not make any events WILMA(x, y, ...) -- will create an event based off of class made by FRED BARNEY(x, ...) -- will create both a class and an event

/* Little known secret, WILMA can also fool around with BARNEY and can create new events with BARNEY as well as with FRED */

(apologies to Thomas Gleixner and his renaming to "fred")

arch/powerpc/include/asm/trace.h +6 -6
index cbe2297..6427fb6 100644
@@ -8,7 +8,7 @@
 
 struct pt_regs;
 
-TRACE_EVENT(irq_entry,
+BARNEY(irq_entry,
 
 	TP_PROTO(struct pt_regs *regs),
 
@@ -25,7 +25,7 @@ TRACE_EVENT(irq_entry,
 	TP_printk("pt_regs=%p", __entry->regs)
 );
 
-TRACE_EVENT(irq_exit,
+BARNEY(irq_exit,
 
 	TP_PROTO(struct pt_regs *regs),
 
@@ -42,7 +42,7 @@ TRACE_EVENT(irq_exit,
 	TP_printk("pt_regs=%p", __entry->regs)
 );
 
-TRACE_EVENT(timer_interrupt_entry,
+BARNEY(timer_interrupt_entry,
 
 	TP_PROTO(struct pt_regs *regs),
 
@@ -59,7 +59,7 @@ TRACE_EVENT(timer_interrupt_entry,
 	TP_printk("pt_regs=%p", __entry->regs)
 );
 
-TRACE_EVENT(timer_interrupt_exit,
+BARNEY(timer_interrupt_exit,
 
 	TP_PROTO(struct pt_regs *regs),
 
@@ -80,7 +80,7 @@ TRACE_EVENT(timer_interrupt_exit,
 extern void hcall_tracepoint_regfunc(void);
 extern void hcall_tracepoint_unregfunc(void);
 
-TRACE_EVENT_FN(hcall_entry,
+BARNEY_FN(hcall_entry,
 
 	TP_PROTO(unsigned long opcode, unsigned long *args),
 
@@ -99,7 +99,7 @@ TRACE_EVENT_FN(hcall_entry,
 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
 );
 
-TRACE_EVENT_FN(hcall_exit,
+BARNEY_FN(hcall_exit,
 
 	TP_PROTO(unsigned long opcode, unsigned long retval,
 		unsigned long *retbuf),
arch/powerpc/kvm/trace.h +4 -4
index 67f219d..53c838f 100644
@@ -11,7 +11,7 @@
 /*
  * Tracepoint for guest mode entry.
  */
-TRACE_EVENT(kvm_ppc_instr,
+BARNEY(kvm_ppc_instr,
 	TP_PROTO(unsigned int inst, unsigned long pc, unsigned int emulate),
 	TP_ARGS(inst, pc, emulate),
 
@@ -31,7 +31,7 @@ TRACE_EVENT(kvm_ppc_instr,
 		  __entry->inst, __entry->pc, __entry->emulate)
 );
 
-TRACE_EVENT(kvm_stlb_inval,
+BARNEY(kvm_stlb_inval,
 	TP_PROTO(unsigned int stlb_index),
 	TP_ARGS(stlb_index),
 
@@ -46,7 +46,7 @@ TRACE_EVENT(kvm_stlb_inval,
 	TP_printk("stlb_index %u", __entry->stlb_index)
 );
 
-TRACE_EVENT(kvm_stlb_write,
+BARNEY(kvm_stlb_write,
 	TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0,
 		 unsigned int word1, unsigned int word2),
 	TP_ARGS(victim, tid, word0, word1, word2),
@@ -72,7 +72,7 @@ TRACE_EVENT(kvm_stlb_write,
 		__entry->word1, __entry->word2)
 );
 
-TRACE_EVENT(kvm_gtlb_write,
+BARNEY(kvm_gtlb_write,
 	TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0,
 		 unsigned int word1, unsigned int word2),
 	TP_ARGS(gtlb_index, tid, word0, word1, word2),
arch/powerpc/platforms/cell/spufs/sputrace.h +1 -1
index db2656a..4ceb1a9 100644
@@ -6,7 +6,7 @@
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM spufs
 
-TRACE_EVENT(spufs_context,
+BARNEY(spufs_context,
 	TP_PROTO(struct spu_context *ctx, struct spu *spu, const char *name),
 	TP_ARGS(ctx, spu, name),
 
arch/x86/kvm/mmutrace.h +9 -9
index 3e4a5c6..6a4c1df 100644
@@ -54,7 +54,7 @@
 /*
  * A pagetable walk has started
  */
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_pagetable_walk,
 	TP_PROTO(u64 addr, int write_fault, int user_fault, int fetch_fault),
 	TP_ARGS(addr, write_fault, user_fault, fetch_fault),
@@ -76,7 +76,7 @@ TRACE_EVENT(
 
 
 /* We just walked a paging element */
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_paging_element,
 	TP_PROTO(u64 pte, int level),
 	TP_ARGS(pte, level),
@@ -95,7 +95,7 @@ TRACE_EVENT(
 );
 
 /* We set a pte accessed bit */
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_set_accessed_bit,
 	TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size),
 	TP_ARGS(table_gfn, index, size),
@@ -113,7 +113,7 @@ TRACE_EVENT(
 );
 
 /* We set a pte dirty bit */
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_set_dirty_bit,
 	TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size),
 	TP_ARGS(table_gfn, index, size),
@@ -130,7 +130,7 @@ TRACE_EVENT(
 	TP_printk("gpa %llx", __entry->gpa)
 );
 
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_walker_error,
 	TP_PROTO(u32 pferr),
 	TP_ARGS(pferr),
@@ -147,7 +147,7 @@ TRACE_EVENT(
 		  __print_flags(__entry->pferr, "|", kvm_mmu_trace_pferr_flags))
 );
 
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_get_page,
 	TP_PROTO(struct kvm_mmu_page *sp, bool created),
 	TP_ARGS(sp, created),
@@ -166,7 +166,7 @@ TRACE_EVENT(
 		  __entry->created ? "new" : "existing")
 );
 
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_sync_page,
 	TP_PROTO(struct kvm_mmu_page *sp),
 	TP_ARGS(sp),
@@ -182,7 +182,7 @@ TRACE_EVENT(
 	TP_printk("%s", KVM_MMU_PAGE_PRINTK())
 );
 
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_unsync_page,
 	TP_PROTO(struct kvm_mmu_page *sp),
 	TP_ARGS(sp),
@@ -198,7 +198,7 @@ TRACE_EVENT(
 	TP_printk("%s", KVM_MMU_PAGE_PRINTK())
 );
 
-TRACE_EVENT(
+BARNEY(
 	kvm_mmu_zap_page,
 	TP_PROTO(struct kvm_mmu_page *sp),
 	TP_ARGS(sp),
arch/x86/kvm/trace.h +13 -13
index 0d480e7..bbe873f 100644
@@ -11,7 +11,7 @@
 /*
  * Tracepoint for guest mode entry.
  */
-TRACE_EVENT(kvm_entry,
+BARNEY(kvm_entry,
 	TP_PROTO(unsigned int vcpu_id),
 	TP_ARGS(vcpu_id),
 
@@ -29,7 +29,7 @@ TRACE_EVENT(kvm_entry,
 /*
  * Tracepoint for hypercall.
  */
-TRACE_EVENT(kvm_hypercall,
+BARNEY(kvm_hypercall,
 	TP_PROTO(unsigned long nr, unsigned long a0, unsigned long a1,
 		 unsigned long a2, unsigned long a3),
 	TP_ARGS(nr, a0, a1, a2, a3),
@@ -58,7 +58,7 @@ TRACE_EVENT(kvm_hypercall,
 /*
  * Tracepoint for PIO.
  */
-TRACE_EVENT(kvm_pio,
+BARNEY(kvm_pio,
 	TP_PROTO(unsigned int rw, unsigned int port, unsigned int size,
 		 unsigned int count),
 	TP_ARGS(rw, port, size, count),
@@ -85,7 +85,7 @@ TRACE_EVENT(kvm_pio,
 /*
  * Tracepoint for cpuid.
  */
-TRACE_EVENT(kvm_cpuid,
+BARNEY(kvm_cpuid,
 	TP_PROTO(unsigned int function, unsigned long rax, unsigned long rbx,
 		 unsigned long rcx, unsigned long rdx),
 	TP_ARGS(function, rax, rbx, rcx, rdx),
@@ -123,7 +123,7 @@ TRACE_EVENT(kvm_cpuid,
 /*
  * Tracepoint for apic access.
  */
-TRACE_EVENT(kvm_apic,
+BARNEY(kvm_apic,
 	TP_PROTO(unsigned int rw, unsigned int reg, unsigned int val),
 	TP_ARGS(rw, reg, val),
 
@@ -151,7 +151,7 @@ TRACE_EVENT(kvm_apic,
 /*
  * Tracepoint for kvm guest exit:
  */
-TRACE_EVENT(kvm_exit,
+BARNEY(kvm_exit,
 	TP_PROTO(unsigned int exit_reason, unsigned long guest_rip),
 	TP_ARGS(exit_reason, guest_rip),
 
@@ -174,7 +174,7 @@ TRACE_EVENT(kvm_exit,
 /*
  * Tracepoint for kvm interrupt injection:
  */
-TRACE_EVENT(kvm_inj_virq,
+BARNEY(kvm_inj_virq,
 	TP_PROTO(unsigned int irq),
 	TP_ARGS(irq),
 
@@ -192,7 +192,7 @@ TRACE_EVENT(kvm_inj_virq,
 /*
  * Tracepoint for page fault.
  */
-TRACE_EVENT(kvm_page_fault,
+BARNEY(kvm_page_fault,
 	TP_PROTO(unsigned long fault_address, unsigned int error_code),
 	TP_ARGS(fault_address, error_code),
 
@@ -213,7 +213,7 @@ TRACE_EVENT(kvm_page_fault,
 /*
  * Tracepoint for guest MSR access.
  */
-TRACE_EVENT(kvm_msr,
+BARNEY(kvm_msr,
 	TP_PROTO(unsigned int rw, unsigned int ecx, unsigned long data),
 	TP_ARGS(rw, ecx, data),
 
@@ -240,7 +240,7 @@ TRACE_EVENT(kvm_msr,
 /*
  * Tracepoint for guest CR access.
  */
-TRACE_EVENT(kvm_cr,
+BARNEY(kvm_cr,
 	TP_PROTO(unsigned int rw, unsigned int cr, unsigned long val),
 	TP_ARGS(rw, cr, val),
 
@@ -264,7 +264,7 @@ TRACE_EVENT(kvm_cr,
 #define trace_kvm_cr_read(cr, val)		trace_kvm_cr(0, cr, val)
 #define trace_kvm_cr_write(cr, val)		trace_kvm_cr(1, cr, val)
 
-TRACE_EVENT(kvm_pic_set_irq,
+BARNEY(kvm_pic_set_irq,
 	    TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced),
 	    TP_ARGS(chip, pin, elcr, imr, coalesced),
 
@@ -297,7 +297,7 @@ TRACE_EVENT(kvm_pic_set_irq,
 	{0x2, "all"},			\
 	{0x3, "all-but-self"}
 
-TRACE_EVENT(kvm_apic_ipi,
+BARNEY(kvm_apic_ipi,
 	    TP_PROTO(__u32 icr_low, __u32 dest_id),
 	    TP_ARGS(icr_low, dest_id),
 
@@ -322,7 +322,7 @@ TRACE_EVENT(kvm_apic_ipi,
 				   kvm_apic_dst_shorthand))
 );
 
-TRACE_EVENT(kvm_apic_accept_irq,
+BARNEY(kvm_apic_accept_irq,
 	    TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec, bool coalesced),
 	    TP_ARGS(apicid, dm, tm, vec, coalesced),
 
drivers/gpu/drm/i915/i915_trace.h +15 -15
index 01840d9..72b067c 100644
@@ -14,7 +14,7 @@
 
 /* object tracking */
 
-TRACE_EVENT(i915_gem_object_create,
+BARNEY(i915_gem_object_create,
 
 	    TP_PROTO(struct drm_gem_object *obj),
 
@@ -33,7 +33,7 @@ TRACE_EVENT(i915_gem_object_create,
 	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
 );
 
-TRACE_EVENT(i915_gem_object_bind,
+BARNEY(i915_gem_object_bind,
 
 	    TP_PROTO(struct drm_gem_object *obj, u32 gtt_offset),
 
@@ -53,7 +53,7 @@ TRACE_EVENT(i915_gem_object_bind,
 		      __entry->obj, __entry->gtt_offset)
 );
 
-TRACE_EVENT(i915_gem_object_clflush,
+BARNEY(i915_gem_object_clflush,
 
 	    TP_PROTO(struct drm_gem_object *obj),
 
@@ -70,7 +70,7 @@ TRACE_EVENT(i915_gem_object_clflush,
 	    TP_printk("obj=%p", __entry->obj)
 );
 
-TRACE_EVENT(i915_gem_object_change_domain,
+BARNEY(i915_gem_object_change_domain,
 
 	    TP_PROTO(struct drm_gem_object *obj, uint32_t old_read_domains, uint32_t old_write_domain),
 
@@ -93,7 +93,7 @@ TRACE_EVENT(i915_gem_object_change_domain,
 		      __entry->read_domains, __entry->write_domain)
 );
 
-TRACE_EVENT(i915_gem_object_get_fence,
+BARNEY(i915_gem_object_get_fence,
 
 	    TP_PROTO(struct drm_gem_object *obj, int fence, int tiling_mode),
 
@@ -115,7 +115,7 @@ TRACE_EVENT(i915_gem_object_get_fence,
 		      __entry->obj, __entry->fence, __entry->tiling_mode)
 );
 
-TRACE_EVENT(i915_gem_object_unbind,
+BARNEY(i915_gem_object_unbind,
 
 	    TP_PROTO(struct drm_gem_object *obj),
 
@@ -132,7 +132,7 @@ TRACE_EVENT(i915_gem_object_unbind,
 	    TP_printk("obj=%p", __entry->obj)
 );
 
-TRACE_EVENT(i915_gem_object_destroy,
+BARNEY(i915_gem_object_destroy,
 
 	    TP_PROTO(struct drm_gem_object *obj),
 
@@ -151,7 +151,7 @@ TRACE_EVENT(i915_gem_object_destroy,
 
 /* batch tracing */
 
-TRACE_EVENT(i915_gem_request_submit,
+BARNEY(i915_gem_request_submit,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno),
 
@@ -171,7 +171,7 @@ TRACE_EVENT(i915_gem_request_submit,
 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
 );
 
-TRACE_EVENT(i915_gem_request_flush,
+BARNEY(i915_gem_request_flush,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno,
 		     u32 flush_domains, u32 invalidate_domains),
@@ -198,7 +198,7 @@ TRACE_EVENT(i915_gem_request_flush,
 );
 
 
-TRACE_EVENT(i915_gem_request_complete,
+BARNEY(i915_gem_request_complete,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno),
 
@@ -217,7 +217,7 @@ TRACE_EVENT(i915_gem_request_complete,
 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
 );
 
-TRACE_EVENT(i915_gem_request_retire,
+BARNEY(i915_gem_request_retire,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno),
 
@@ -236,7 +236,7 @@ TRACE_EVENT(i915_gem_request_retire,
 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
 );
 
-TRACE_EVENT(i915_gem_request_wait_begin,
+BARNEY(i915_gem_request_wait_begin,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno),
 
@@ -255,7 +255,7 @@ TRACE_EVENT(i915_gem_request_wait_begin,
 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
 );
 
-TRACE_EVENT(i915_gem_request_wait_end,
+BARNEY(i915_gem_request_wait_end,
 
 	    TP_PROTO(struct drm_device *dev, u32 seqno),
 
@@ -274,7 +274,7 @@ TRACE_EVENT(i915_gem_request_wait_end,
 	    TP_printk("dev=%u, seqno=%u", __entry->dev, __entry->seqno)
 );
 
-TRACE_EVENT(i915_ring_wait_begin,
+BARNEY(i915_ring_wait_begin,
 
 	    TP_PROTO(struct drm_device *dev),
 
@@ -291,7 +291,7 @@ TRACE_EVENT(i915_ring_wait_begin,
 	    TP_printk("dev=%u", __entry->dev)
 );
 
-TRACE_EVENT(i915_ring_wait_end,
+BARNEY(i915_ring_wait_end,
 
 	    TP_PROTO(struct drm_device *dev),
 
fs/gfs2/trace_gfs2.h +10 -10
index 148d55c..fabb5a6 100644
@@ -68,7 +68,7 @@ static inline u8 glock_trace_state(unsigned int state)
  */
 
 /* General glock state change (DLM lock request completes) */
-TRACE_EVENT(gfs2_glock_state_change,
+BARNEY(gfs2_glock_state_change,
 
 	TP_PROTO(const struct gfs2_glock *gl, unsigned int new_state),
 
@@ -107,7 +107,7 @@ TRACE_EVENT(gfs2_glock_state_change,
 );
 
 /* State change -> unlocked, glock is being deallocated */
-TRACE_EVENT(gfs2_glock_put,
+BARNEY(gfs2_glock_put,
 
 	TP_PROTO(const struct gfs2_glock *gl),
 
@@ -139,7 +139,7 @@ TRACE_EVENT(gfs2_glock_put,
 );
 
 /* Callback (local or remote) requesting lock demotion */
-TRACE_EVENT(gfs2_demote_rq,
+BARNEY(gfs2_demote_rq,
 
 	TP_PROTO(const struct gfs2_glock *gl),
 
@@ -173,7 +173,7 @@ TRACE_EVENT(gfs2_demote_rq,
 );
 
 /* Promotion/grant of a glock */
-TRACE_EVENT(gfs2_promote,
+BARNEY(gfs2_promote,
 
 	TP_PROTO(const struct gfs2_holder *gh, int first),
 
@@ -203,7 +203,7 @@ TRACE_EVENT(gfs2_promote,
 );
 
 /* Queue/dequeue a lock request */
-TRACE_EVENT(gfs2_glock_queue,
+BARNEY(gfs2_glock_queue,
 
 	TP_PROTO(const struct gfs2_holder *gh, int queue),
 
@@ -241,7 +241,7 @@ TRACE_EVENT(gfs2_glock_queue,
  */
 
 /* Pin/unpin a block in the log */
-TRACE_EVENT(gfs2_pin,
+BARNEY(gfs2_pin,
 
 	TP_PROTO(const struct gfs2_bufdata *bd, int pin),
 
@@ -272,7 +272,7 @@ TRACE_EVENT(gfs2_pin,
 );
 
 /* Flushing the log */
-TRACE_EVENT(gfs2_log_flush,
+BARNEY(gfs2_log_flush,
 
 	TP_PROTO(const struct gfs2_sbd *sdp, int start),
 
@@ -297,7 +297,7 @@ TRACE_EVENT(gfs2_log_flush,
 );
 
 /* Reserving/releasing blocks in the log */
-TRACE_EVENT(gfs2_log_blocks,
+BARNEY(gfs2_log_blocks,
 
 	TP_PROTO(const struct gfs2_sbd *sdp, int blocks),
 
@@ -326,7 +326,7 @@ TRACE_EVENT(gfs2_log_blocks,
  */
 
 /* Map an extent of blocks, possibly a new allocation */
-TRACE_EVENT(gfs2_bmap,
+BARNEY(gfs2_bmap,
 
 	TP_PROTO(const struct gfs2_inode *ip, const struct buffer_head *bh,
 		sector_t lblock, int create, int errno),
@@ -366,7 +366,7 @@ TRACE_EVENT(gfs2_bmap,
 );
 
 /* Keep track of blocks as they are allocated/freed */
-TRACE_EVENT(gfs2_block_alloc,
+BARNEY(gfs2_block_alloc,
 
 	TP_PROTO(const struct gfs2_inode *ip, u64 block, unsigned len,
 		u8 block_state),
include/asm-generic/vmlinux.lds.h +3 -3
index b6e818f..a2fcf5f 100644
@@ -113,11 +113,11 @@
 #endif
 
 #ifdef CONFIG_EVENT_TRACING
-#define FTRACE_EVENTS()	VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
+#define FBARNEYS()	VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
 			*(_ftrace_events)				\
 			VMLINUX_SYMBOL(__stop_ftrace_events) = .;
 #else
-#define FTRACE_EVENTS()
+#define FBARNEYS()
 #endif
 
 #ifdef CONFIG_TRACING
@@ -162,7 +162,7 @@
 	LIKELY_PROFILE()		       				\
 	BRANCH_PROFILE()						\
 	TRACE_PRINTKS()							\
-	FTRACE_EVENTS()							\
+	FBARNEYS()							\
 	TRACE_SYSCALLS()
 
 /*
include/linux/ftrace_event.h +3 -3
index 47bbdf9..764391f 100644
@@ -1,5 +1,5 @@
-#ifndef _LINUX_FTRACE_EVENT_H
-#define _LINUX_FTRACE_EVENT_H
+#ifndef _LINUX_FBARNEY_H
+#define _LINUX_FBARNEY_H
 
 #include <linux/ring_buffer.h>
 #include <linux/trace_seq.h>
@@ -196,4 +196,4 @@ extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
 extern void ftrace_profile_free_filter(struct perf_event *event);
 #endif
 
-#endif /* _LINUX_FTRACE_EVENT_H */
+#endif /* _LINUX_FBARNEY_H */
include/linux/tracepoint.h +13 -13
index f59604e..eac3f68 100644
@@ -168,27 +168,27 @@ static inline void tracepoint_synchronize_unregister(void)
 #endif /* _LINUX_TRACEPOINT_H */
 
 /*
- * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
+ * Note: we keep the BARNEY outside the include file ifdef protection.
  *  This is due to the way trace events work. If a file includes two
  *  trace event headers under one "CREATE_TRACE_POINTS" the first include
- *  will override the TRACE_EVENT and break the second include.
+ *  will override the BARNEY and break the second include.
  */
 
-#ifndef TRACE_EVENT
+#ifndef BARNEY
 /*
- * For use with the TRACE_EVENT macro:
+ * For use with the BARNEY macro:
  *
  * We define a tracepoint, its arguments, its printk format
  * and its 'fast binay record' layout.
  *
- * Firstly, name your tracepoint via TRACE_EVENT(name : the
+ * Firstly, name your tracepoint via BARNEY(name : the
  * 'subsystem_event' notation is fine.
  *
  * Think about this whole construct as the
  * 'trace_sched_switch() function' from now on.
  *
  *
- *  TRACE_EVENT(sched_switch,
+ *  BARNEY(sched_switch,
  *
  *	*
  *	* A function has a regular function arguments
@@ -277,19 +277,19 @@ static inline void tracepoint_synchronize_unregister(void)
  * /sys/kernel/debug/tracing/events/.
  *
  * A set of (un)registration functions can be passed to the variant
- * TRACE_EVENT_FN to perform any (un)registration work.
+ * BARNEY_FN to perform any (un)registration work.
  */
 
-#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
-#define DEFINE_EVENT(template, name, proto, args)		\
+#define FRED(name, proto, args, tstruct, assign, print)
+#define WILMA(template, name, proto, args)		\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
+#define WILMA_PRINT(template, name, proto, args, print)	\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
-#define TRACE_EVENT(name, proto, args, struct, assign, print)	\
+#define BARNEY(name, proto, args, struct, assign, print)	\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
-#define TRACE_EVENT_FN(name, proto, args, struct,		\
+#define BARNEY_FN(name, proto, args, struct,		\
 		assign, print, reg, unreg)			\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
-#endif /* ifdef TRACE_EVENT (see note above) */
+#endif /* ifdef BARNEY (see note above) */
include/trace/define_trace.h +13 -13
index 5acfb1e..a3d4749 100644
@@ -22,21 +22,21 @@
 
 #include <linux/stringify.h>
 
-#undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, args, tstruct, assign, print)	\
+#undef BARNEY
+#define BARNEY(name, proto, args, tstruct, assign, print)	\
 	DEFINE_TRACE(name)
 
-#undef TRACE_EVENT_FN
-#define TRACE_EVENT_FN(name, proto, args, tstruct,		\
+#undef BARNEY_FN
+#define BARNEY_FN(name, proto, args, tstruct,		\
 		assign, print, reg, unreg)			\
 	DEFINE_TRACE_FN(name, reg, unreg)
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(template, name, proto, args) \
+#undef WILMA
+#define WILMA(template, name, proto, args) \
 	DEFINE_TRACE(name)
 
-#undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
+#undef WILMA_PRINT
+#define WILMA_PRINT(template, name, proto, args, print)	\
 	DEFINE_TRACE(name)
 
 #undef DECLARE_TRACE
@@ -69,11 +69,11 @@
 #include <trace/ftrace.h>
 #endif
 
-#undef TRACE_EVENT
-#undef TRACE_EVENT_FN
-#undef DECLARE_EVENT_CLASS
-#undef DEFINE_EVENT
-#undef DEFINE_EVENT_PRINT
+#undef BARNEY
+#undef BARNEY_FN
+#undef FRED
+#undef WILMA
+#undef WILMA_PRINT
 #undef TRACE_HEADER_MULTI_READ
 
 /* Only undef what we defined in this file */
include/trace/events/bkl.h +2 -2
index 1af72dc..03ad013 100644
@@ -6,7 +6,7 @@
 
 #include <linux/tracepoint.h>
 
-TRACE_EVENT(lock_kernel,
+BARNEY(lock_kernel,
 
 	TP_PROTO(const char *func, const char *file, int line),
 
@@ -31,7 +31,7 @@ TRACE_EVENT(lock_kernel,
 		  __entry->file, __entry->line, __entry->func)
 );
 
-TRACE_EVENT(unlock_kernel,
+BARNEY(unlock_kernel,
 
 	TP_PROTO(const char *func, const char *file, int line),
 
include/trace/events/block.h +23 -23

184 lines not on this page · raw message

include/trace/events/ext4.h +32 -32

256 lines not on this page · raw message

include/trace/events/irq.h +5 -5
index 0e4cfb6..077be6d 100644
@@ -32,7 +32,7 @@
  * conjunction with the irq_handler_exit tracepoint, we can figure
  * out irq handler latencies.
  */
-TRACE_EVENT(irq_handler_entry,
+BARNEY(irq_handler_entry,
 
 	TP_PROTO(int irq, struct irqaction *action),
 
@@ -62,7 +62,7 @@ TRACE_EVENT(irq_handler_entry,
  * a shared irq line, or the irq was not handled successfully. Can be used in
  * conjunction with the irq_handler_entry to understand irq handler latencies.
  */
-TRACE_EVENT(irq_handler_exit,
+BARNEY(irq_handler_exit,
 
 	TP_PROTO(int irq, struct irqaction *action, int ret),
 
@@ -82,7 +82,7 @@ TRACE_EVENT(irq_handler_exit,
 		  __entry->irq, __entry->ret ? "handled" : "unhandled")
 );
 
-DECLARE_EVENT_CLASS(softirq,
+FRED(softirq,
 
 	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
 
@@ -111,7 +111,7 @@ DECLARE_EVENT_CLASS(softirq,
  * number. Also, when used in combination with the softirq_exit tracepoint
  * we can determine the softirq latency.
  */
-DEFINE_EVENT(softirq, softirq_entry,
+WILMA(softirq, softirq_entry,
 
 	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
 
@@ -129,7 +129,7 @@ DEFINE_EVENT(softirq, softirq_entry,
  * combination with the softirq_entry tracepoint we can determine the softirq
  * latency.
  */
-DEFINE_EVENT(softirq, softirq_exit,
+WILMA(softirq, softirq_exit,
 
 	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
 
include/trace/events/jbd2.h +10 -10
index 96b370a..a0a6a0e 100644
@@ -10,7 +10,7 @@
 struct transaction_chp_stats_s;
 struct transaction_run_stats_s;
 
-TRACE_EVENT(jbd2_checkpoint,
+BARNEY(jbd2_checkpoint,
 
 	TP_PROTO(journal_t *journal, int result),
 
@@ -30,7 +30,7 @@ TRACE_EVENT(jbd2_checkpoint,
 		  jbd2_dev_to_name(__entry->dev), __entry->result)
 );
 
-DECLARE_EVENT_CLASS(jbd2_commit,
+FRED(jbd2_commit,
 
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
@@ -53,35 +53,35 @@ DECLARE_EVENT_CLASS(jbd2_commit,
 		  __entry->sync_commit)
 );
 
-DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
+WILMA(jbd2_commit, jbd2_start_commit,
 
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
 	TP_ARGS(journal, commit_transaction)
 );
 
-DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
+WILMA(jbd2_commit, jbd2_commit_locking,
 
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
 	TP_ARGS(journal, commit_transaction)
 );
 
-DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
+WILMA(jbd2_commit, jbd2_commit_flushing,
 
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
 	TP_ARGS(journal, commit_transaction)
 );
 
-DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
+WILMA(jbd2_commit, jbd2_commit_logging,
 
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
 	TP_ARGS(journal, commit_transaction)
 );
 
-TRACE_EVENT(jbd2_end_commit,
+BARNEY(jbd2_end_commit,
 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
 
 	TP_ARGS(journal, commit_transaction),
@@ -105,7 +105,7 @@ TRACE_EVENT(jbd2_end_commit,
 		  __entry->sync_commit, __entry->head)
 );
 
-TRACE_EVENT(jbd2_submit_inode_data,
+BARNEY(jbd2_submit_inode_data,
 	TP_PROTO(struct inode *inode),
 
 	TP_ARGS(inode),
@@ -124,7 +124,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
 		  jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
 );
 
-TRACE_EVENT(jbd2_run_stats,
+BARNEY(jbd2_run_stats,
 	TP_PROTO(dev_t dev, unsigned long tid,
 		 struct transaction_run_stats_s *stats),
 
@@ -168,7 +168,7 @@ TRACE_EVENT(jbd2_run_stats,
 		  __entry->blocks_logged)
 );
 
-TRACE_EVENT(jbd2_checkpoint_stats,
+BARNEY(jbd2_checkpoint_stats,
 	TP_PROTO(dev_t dev, unsigned long tid,
 		 struct transaction_chp_stats_s *stats),
 
include/trace/events/kmem.h +16 -16
index 3adca0c..ae51357 100644
@@ -44,7 +44,7 @@
 	{(unsigned long)__GFP_MOVABLE,		"GFP_MOVABLE"}		\
 	) : "GFP_NOWAIT"
 
-DECLARE_EVENT_CLASS(kmem_alloc,
+FRED(kmem_alloc,
 
 	TP_PROTO(unsigned long call_site,
 		 const void *ptr,
@@ -78,7 +78,7 @@ DECLARE_EVENT_CLASS(kmem_alloc,
 		show_gfp_flags(__entry->gfp_flags))
 );
 
-DEFINE_EVENT(kmem_alloc, kmalloc,
+WILMA(kmem_alloc, kmalloc,
 
 	TP_PROTO(unsigned long call_site, const void *ptr,
 		 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
@@ -86,7 +86,7 @@ DEFINE_EVENT(kmem_alloc, kmalloc,
 	TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
 );
 
-DEFINE_EVENT(kmem_alloc, kmem_cache_alloc,
+WILMA(kmem_alloc, kmem_cache_alloc,
 
 	TP_PROTO(unsigned long call_site, const void *ptr,
 		 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
@@ -94,7 +94,7 @@ DEFINE_EVENT(kmem_alloc, kmem_cache_alloc,
 	TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
 );
 
-DECLARE_EVENT_CLASS(kmem_alloc_node,
+FRED(kmem_alloc_node,
 
 	TP_PROTO(unsigned long call_site,
 		 const void *ptr,
@@ -132,7 +132,7 @@ DECLARE_EVENT_CLASS(kmem_alloc_node,
 		__entry->node)
 );
 
-DEFINE_EVENT(kmem_alloc_node, kmalloc_node,
+WILMA(kmem_alloc_node, kmalloc_node,
 
 	TP_PROTO(unsigned long call_site, const void *ptr,
 		 size_t bytes_req, size_t bytes_alloc,
@@ -141,7 +141,7 @@ DEFINE_EVENT(kmem_alloc_node, kmalloc_node,
 	TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
 );
 
-DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node,
+WILMA(kmem_alloc_node, kmem_cache_alloc_node,
 
 	TP_PROTO(unsigned long call_site, const void *ptr,
 		 size_t bytes_req, size_t bytes_alloc,
@@ -150,7 +150,7 @@ DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node,
 	TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
 );
 
-DECLARE_EVENT_CLASS(kmem_free,
+FRED(kmem_free,
 
 	TP_PROTO(unsigned long call_site, const void *ptr),
 
@@ -169,21 +169,21 @@ DECLARE_EVENT_CLASS(kmem_free,
 	TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
 );
 
-DEFINE_EVENT(kmem_free, kfree,
+WILMA(kmem_free, kfree,
 
 	TP_PROTO(unsigned long call_site, const void *ptr),
 
 	TP_ARGS(call_site, ptr)
 );
 
-DEFINE_EVENT(kmem_free, kmem_cache_free,
+WILMA(kmem_free, kmem_cache_free,
 
 	TP_PROTO(unsigned long call_site, const void *ptr),
 
 	TP_ARGS(call_site, ptr)
 );
 
-TRACE_EVENT(mm_page_free_direct,
+BARNEY(mm_page_free_direct,
 
 	TP_PROTO(struct page *page, unsigned int order),
 
@@ -205,7 +205,7 @@ TRACE_EVENT(mm_page_free_direct,
 			__entry->order)
 );
 
-TRACE_EVENT(mm_pagevec_free,
+BARNEY(mm_pagevec_free,
 
 	TP_PROTO(struct page *page, int cold),
 
@@ -227,7 +227,7 @@ TRACE_EVENT(mm_pagevec_free,
 			__entry->cold)
 );
 
-TRACE_EVENT(mm_page_alloc,
+BARNEY(mm_page_alloc,
 
 	TP_PROTO(struct page *page, unsigned int order,
 			gfp_t gfp_flags, int migratetype),
@@ -256,7 +256,7 @@ TRACE_EVENT(mm_page_alloc,
 		show_gfp_flags(__entry->gfp_flags))
 );
 
-DECLARE_EVENT_CLASS(mm_page,
+FRED(mm_page,
 
 	TP_PROTO(struct page *page, unsigned int order, int migratetype),
 
@@ -282,14 +282,14 @@ DECLARE_EVENT_CLASS(mm_page,
 		__entry->order == 0)
 );
 
-DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked,
+WILMA(mm_page, mm_page_alloc_zone_locked,
 
 	TP_PROTO(struct page *page, unsigned int order, int migratetype),
 
 	TP_ARGS(page, order, migratetype)
 );
 
-DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
+WILMA_PRINT(mm_page, mm_page_pcpu_drain,
 
 	TP_PROTO(struct page *page, unsigned int order, int migratetype),
 
@@ -300,7 +300,7 @@ DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
 		__entry->order, __entry->migratetype)
 );
 
-TRACE_EVENT(mm_page_alloc_extfrag,
+BARNEY(mm_page_alloc_extfrag,
 
 	TP_PROTO(struct page *page,
 			int alloc_order, int fallback_order,
include/trace/events/kvm.h +5 -5
index dbe1084..1a2a4eb 100644
@@ -8,7 +8,7 @@
 #define TRACE_INCLUDE_FILE kvm
 
 #if defined(__KVM_HAVE_IOAPIC)
-TRACE_EVENT(kvm_set_irq,
+BARNEY(kvm_set_irq,
 	TP_PROTO(unsigned int gsi, int level, int irq_source_id),
 	TP_ARGS(gsi, level, irq_source_id),
 
@@ -38,7 +38,7 @@ TRACE_EVENT(kvm_set_irq,
 	{0x6, "SIPI"},			\
 	{0x7, "ExtINT"}
 
-TRACE_EVENT(kvm_ioapic_set_irq,
+BARNEY(kvm_ioapic_set_irq,
 	    TP_PROTO(__u64 e, int pin, bool coalesced),
 	    TP_ARGS(e, pin, coalesced),
 
@@ -63,7 +63,7 @@ TRACE_EVENT(kvm_ioapic_set_irq,
 		  __entry->coalesced ? " (coalesced)" : "")
 );
 
-TRACE_EVENT(kvm_msi_set_irq,
+BARNEY(kvm_msi_set_irq,
 	    TP_PROTO(__u64 address, __u64 data),
 	    TP_ARGS(address, data),
 
@@ -90,7 +90,7 @@ TRACE_EVENT(kvm_msi_set_irq,
 	{KVM_IRQCHIP_PIC_SLAVE,		"PIC slave"},		\
 	{KVM_IRQCHIP_IOAPIC,		"IOAPIC"}
 
-TRACE_EVENT(kvm_ack_irq,
+BARNEY(kvm_ack_irq,
 	TP_PROTO(unsigned int irqchip, unsigned int pin),
 	TP_ARGS(irqchip, pin),
 
@@ -122,7 +122,7 @@ TRACE_EVENT(kvm_ack_irq,
 	{ KVM_TRACE_MMIO_READ, "read" }, \
 	{ KVM_TRACE_MMIO_WRITE, "write" }
 
-TRACE_EVENT(kvm_mmio,
+BARNEY(kvm_mmio,
 	TP_PROTO(int type, int len, u64 gpa, u64 val),
 	TP_ARGS(type, len, gpa, val),
 
include/trace/events/lock.h +4 -4
index a870ba1..641773f 100644
@@ -9,7 +9,7 @@
 
 #ifdef CONFIG_LOCKDEP
 
-TRACE_EVENT(lock_acquire,
+BARNEY(lock_acquire,
 
 	TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
 		int trylock, int read, int check,
@@ -32,7 +32,7 @@ TRACE_EVENT(lock_acquire,
 		  __get_str(name))
 );
 
-TRACE_EVENT(lock_release,
+BARNEY(lock_release,
 
 	TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
 
@@ -51,7 +51,7 @@ TRACE_EVENT(lock_release,
 
 #ifdef CONFIG_LOCK_STAT
 
-TRACE_EVENT(lock_contended,
+BARNEY(lock_contended,
 
 	TP_PROTO(struct lockdep_map *lock, unsigned long ip),
 
@@ -68,7 +68,7 @@ TRACE_EVENT(lock_contended,
 	TP_printk("%s", __get_str(name))
 );
 
-TRACE_EVENT(lock_acquired,
+BARNEY(lock_acquired,
 	TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
 
 	TP_ARGS(lock, ip, waittime),
include/trace/events/module.h +6 -6
index 4b0f48b..e441922 100644
@@ -15,7 +15,7 @@ struct module;
 	{ (1UL << TAINT_FORCED_MODULE),		"F" },		\
 	{ (1UL << TAINT_CRAP),			"C" })
 
-TRACE_EVENT(module_load,
+BARNEY(module_load,
 
 	TP_PROTO(struct module *mod),
 
@@ -34,7 +34,7 @@ TRACE_EVENT(module_load,
 	TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints))
 );
 
-TRACE_EVENT(module_free,
+BARNEY(module_free,
 
 	TP_PROTO(struct module *mod),
 
@@ -51,7 +51,7 @@ TRACE_EVENT(module_free,
 	TP_printk("%s", __get_str(name))
 );
 
-DECLARE_EVENT_CLASS(module_refcnt,
+FRED(module_refcnt,
 
 	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
 
@@ -73,21 +73,21 @@ DECLARE_EVENT_CLASS(module_refcnt,
 		  __get_str(name), (void *)__entry->ip, __entry->refcnt)
 );
 
-DEFINE_EVENT(module_refcnt, module_get,
+WILMA(module_refcnt, module_get,
 
 	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
 
 	TP_ARGS(mod, ip, refcnt)
 );
 
-DEFINE_EVENT(module_refcnt, module_put,
+WILMA(module_refcnt, module_put,
 
 	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
 
 	TP_ARGS(mod, ip, refcnt)
 );
 
-TRACE_EVENT(module_request,
+BARNEY(module_request,
 
 	TP_PROTO(char *name, bool wait, unsigned long ip),
 
include/trace/events/power.h +4 -4
index c4efe9b..e004e74 100644
@@ -16,7 +16,7 @@ enum {
 };
 #endif
 
-DECLARE_EVENT_CLASS(power,
+FRED(power,
 
 	TP_PROTO(unsigned int type, unsigned int state),
 
@@ -35,21 +35,21 @@ DECLARE_EVENT_CLASS(power,
 	TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state)
 );
 
-DEFINE_EVENT(power, power_start,
+WILMA(power, power_start,
 
 	TP_PROTO(unsigned int type, unsigned int state),
 
 	TP_ARGS(type, state)
 );
 
-DEFINE_EVENT(power, power_frequency,
+WILMA(power, power_frequency,
 
 	TP_PROTO(unsigned int type, unsigned int state),
 
 	TP_ARGS(type, state)
 );
 
-TRACE_EVENT(power_end,
+BARNEY(power_end,
 
 	TP_PROTO(int dummy),
 
include/trace/events/sched.h +18 -18
index cfceb0b..5a15cde 100644
@@ -10,7 +10,7 @@
 /*
  * Tracepoint for calling kthread_stop, performed to end a kthread:
  */
-TRACE_EVENT(sched_kthread_stop,
+BARNEY(sched_kthread_stop,
 
 	TP_PROTO(struct task_struct *t),
 
@@ -32,7 +32,7 @@ TRACE_EVENT(sched_kthread_stop,
 /*
  * Tracepoint for the return value of the kthread stopping:
  */
-TRACE_EVENT(sched_kthread_stop_ret,
+BARNEY(sched_kthread_stop_ret,
 
 	TP_PROTO(int ret),
 
@@ -55,7 +55,7 @@ TRACE_EVENT(sched_kthread_stop_ret,
  * (NOTE: the 'rq' argument is not used by generic trace events,
  *        but used by the latency tracer plugin. )
  */
-TRACE_EVENT(sched_wait_task,
+BARNEY(sched_wait_task,
 
 	TP_PROTO(struct rq *rq, struct task_struct *p),
 
@@ -83,7 +83,7 @@ TRACE_EVENT(sched_wait_task,
  * (NOTE: the 'rq' argument is not used by generic trace events,
  *        but used by the latency tracer plugin. )
  */
-DECLARE_EVENT_CLASS(sched_wakeup_template,
+FRED(sched_wakeup_template,
 
 	TP_PROTO(struct rq *rq, struct task_struct *p, int success),
 
@@ -110,7 +110,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
 		  __entry->success, __entry->target_cpu)
 );
 
-DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
+WILMA(sched_wakeup_template, sched_wakeup,
 	     TP_PROTO(struct rq *rq, struct task_struct *p, int success),
 	     TP_ARGS(rq, p, success));
 
@@ -120,7 +120,7 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
  * (NOTE: the 'rq' argument is not used by generic trace events,
  *        but used by the latency tracer plugin. )
  */
-DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
+WILMA(sched_wakeup_template, sched_wakeup_new,
 	     TP_PROTO(struct rq *rq, struct task_struct *p, int success),
 	     TP_ARGS(rq, p, success));
 
@@ -130,7 +130,7 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
  * (NOTE: the 'rq' argument is not used by generic trace events,
  *        but used by the latency tracer plugin. )
  */
-TRACE_EVENT(sched_switch,
+BARNEY(sched_switch,
 
 	TP_PROTO(struct rq *rq, struct task_struct *prev,
 		 struct task_struct *next),
@@ -170,7 +170,7 @@ TRACE_EVENT(sched_switch,
 /*
  * Tracepoint for a task being migrated:
  */
-TRACE_EVENT(sched_migrate_task,
+BARNEY(sched_migrate_task,
 
 	TP_PROTO(struct task_struct *p, int dest_cpu),
 
@@ -197,7 +197,7 @@ TRACE_EVENT(sched_migrate_task,
 		  __entry->orig_cpu, __entry->dest_cpu)
 );
 
-DECLARE_EVENT_CLASS(sched_process_template,
+FRED(sched_process_template,
 
 	TP_PROTO(struct task_struct *p),
 
@@ -222,7 +222,7 @@ DECLARE_EVENT_CLASS(sched_process_template,
 /*
  * Tracepoint for freeing a task:
  */
-DEFINE_EVENT(sched_process_template, sched_process_free,
+WILMA(sched_process_template, sched_process_free,
 	     TP_PROTO(struct task_struct *p),
 	     TP_ARGS(p));
 	     
@@ -230,14 +230,14 @@ DEFINE_EVENT(sched_process_template, sched_process_free,
 /*
  * Tracepoint for a task exiting:
  */
-DEFINE_EVENT(sched_process_template, sched_process_exit,
+WILMA(sched_process_template, sched_process_exit,
 	     TP_PROTO(struct task_struct *p),
 	     TP_ARGS(p));
 
 /*
  * Tracepoint for a waiting task:
  */
-TRACE_EVENT(sched_process_wait,
+BARNEY(sched_process_wait,
 
 	TP_PROTO(struct pid *pid),
 
@@ -262,7 +262,7 @@ TRACE_EVENT(sched_process_wait,
 /*
  * Tracepoint for do_fork:
  */
-TRACE_EVENT(sched_process_fork,
+BARNEY(sched_process_fork,
 
 	TP_PROTO(struct task_struct *parent, struct task_struct *child),
 
@@ -291,7 +291,7 @@ TRACE_EVENT(sched_process_fork,
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
-DECLARE_EVENT_CLASS(sched_stat_template,
+FRED(sched_stat_template,
 
 	TP_PROTO(struct task_struct *tsk, u64 delay),
 
@@ -322,7 +322,7 @@ DECLARE_EVENT_CLASS(sched_stat_template,
  * Tracepoint for accounting wait time (time the task is runnable
  * but not actually running due to scheduler contention).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_wait,
+WILMA(sched_stat_template, sched_stat_wait,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
@@ -330,7 +330,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_wait,
  * Tracepoint for accounting sleep time (time the task is not runnable,
  * including iowait, see below).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
+WILMA(sched_stat_template, sched_stat_sleep,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
@@ -338,7 +338,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
  * Tracepoint for accounting iowait time (time the task is not runnable
  * due to waiting on IO to complete).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
+WILMA(sched_stat_template, sched_stat_iowait,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
@@ -346,7 +346,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
  * Tracepoint for accounting runtime (time the task is executing
  * on a CPU).
  */
-TRACE_EVENT(sched_stat_runtime,
+BARNEY(sched_stat_runtime,
 
 	TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
 
include/trace/events/signal.h +4 -4
index a510b75..6b2f798 100644
@@ -34,7 +34,7 @@
  * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
  * means that si_code is SI_KERNEL.
  */
-TRACE_EVENT(signal_generate,
+BARNEY(signal_generate,
 
 	TP_PROTO(int sig, struct siginfo *info, struct task_struct *task),
 
@@ -74,7 +74,7 @@ TRACE_EVENT(signal_generate,
  * This means, this can show which signals are actually delivered, but
  * matching generated signals and delivered signals may not be correct.
  */
-TRACE_EVENT(signal_deliver,
+BARNEY(signal_deliver,
 
 	TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka),
 
@@ -111,7 +111,7 @@ TRACE_EVENT(signal_deliver,
  * 'group' is not 0 if the signal will be sent to a process group.
  * 'sig' is always one of RT signals.
  */
-TRACE_EVENT(signal_overflow_fail,
+BARNEY(signal_overflow_fail,
 
 	TP_PROTO(int sig, int group, struct siginfo *info),
 
@@ -145,7 +145,7 @@ TRACE_EVENT(signal_overflow_fail,
  * 'group' is not 0 if the signal will be sent to a process group.
  * 'sig' is always one of non-RT signals.
  */
-TRACE_EVENT(signal_lose_info,
+BARNEY(signal_lose_info,
 
 	TP_PROTO(int sig, int group, struct siginfo *info),
 
include/trace/events/skb.h +2 -2
index 4b2be6d..55a1082 100644
@@ -11,7 +11,7 @@
 /*
  * Tracepoint for free an sk_buff:
  */
-TRACE_EVENT(kfree_skb,
+BARNEY(kfree_skb,
 
 	TP_PROTO(struct sk_buff *skb, void *location),
 
@@ -35,7 +35,7 @@ TRACE_EVENT(kfree_skb,
 		__entry->skbaddr, __entry->protocol, __entry->location)
 );
 
-TRACE_EVENT(skb_copy_datagram_iovec,
+BARNEY(skb_copy_datagram_iovec,
 
 	TP_PROTO(const struct sk_buff *skb, int len),
 
include/trace/events/syscalls.h +5 -5
index 397dff2..3e70f03 100644
@@ -1,8 +1,8 @@
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM syscalls
 
-#if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_EVENTS_SYSCALLS_H
+#if !defined(_BARNEYS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _BARNEYS_SYSCALLS_H
 
 #include <linux/tracepoint.h>
 
@@ -15,7 +15,7 @@
 extern void syscall_regfunc(void);
 extern void syscall_unregfunc(void);
 
-TRACE_EVENT_FN(sys_enter,
+BARNEY_FN(sys_enter,
 
 	TP_PROTO(struct pt_regs *regs, long id),
 
@@ -39,7 +39,7 @@ TRACE_EVENT_FN(sys_enter,
 	syscall_regfunc, syscall_unregfunc
 );
 
-TRACE_EVENT_FN(sys_exit,
+BARNEY_FN(sys_exit,
 
 	TP_PROTO(struct pt_regs *regs, long ret),
 
@@ -63,7 +63,7 @@ TRACE_EVENT_FN(sys_exit,
 
 #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
 
-#endif /* _TRACE_EVENTS_SYSCALLS_H */
+#endif /* _BARNEYS_SYSCALLS_H */
 
 /* This part must be outside protection */
 #include <trace/define_trace.h>
include/trace/events/timer.h +12 -12
index e5ce87a..63e823e 100644
@@ -12,7 +12,7 @@
  * timer_init - called when the timer is initialized
  * @timer:	pointer to struct timer_list
  */
-TRACE_EVENT(timer_init,
+BARNEY(timer_init,
 
 	TP_PROTO(struct timer_list *timer),
 
@@ -34,7 +34,7 @@ TRACE_EVENT(timer_init,
  * @timer:	pointer to struct timer_list
  * @expires:	the timers expiry time
  */
-TRACE_EVENT(timer_start,
+BARNEY(timer_start,
 
 	TP_PROTO(struct timer_list *timer, unsigned long expires),
 
@@ -65,7 +65,7 @@ TRACE_EVENT(timer_start,
  *
  * Allows to determine the timer latency.
  */
-TRACE_EVENT(timer_expire_entry,
+BARNEY(timer_expire_entry,
 
 	TP_PROTO(struct timer_list *timer),
 
@@ -94,7 +94,7 @@ TRACE_EVENT(timer_expire_entry,
  * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
  * be invalid. We solely track the pointer.
  */
-TRACE_EVENT(timer_expire_exit,
+BARNEY(timer_expire_exit,
 
 	TP_PROTO(struct timer_list *timer),
 
@@ -115,7 +115,7 @@ TRACE_EVENT(timer_expire_exit,
  * timer_cancel - called when the timer is canceled
  * @timer:	pointer to struct timer_list
  */
-TRACE_EVENT(timer_cancel,
+BARNEY(timer_cancel,
 
 	TP_PROTO(struct timer_list *timer),
 
@@ -138,7 +138,7 @@ TRACE_EVENT(timer_cancel,
  * @clockid:	the hrtimers clock
  * @mode:	the hrtimers mode
  */
-TRACE_EVENT(hrtimer_init,
+BARNEY(hrtimer_init,
 
 	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
 		 enum hrtimer_mode mode),
@@ -168,7 +168,7 @@ TRACE_EVENT(hrtimer_init,
  * hrtimer_start - called when the hrtimer is started
  * @timer: pointer to struct hrtimer
  */
-TRACE_EVENT(hrtimer_start,
+BARNEY(hrtimer_start,
 
 	TP_PROTO(struct hrtimer *hrtimer),
 
@@ -204,7 +204,7 @@ TRACE_EVENT(hrtimer_start,
  *
  * Allows to determine the timer latency.
  */
-TRACE_EVENT(hrtimer_expire_entry,
+BARNEY(hrtimer_expire_entry,
 
 	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
 
@@ -231,7 +231,7 @@ TRACE_EVENT(hrtimer_expire_entry,
  * When used in combination with the hrtimer_expire_entry tracepoint we can
  * determine the runtime of the callback function.
  */
-TRACE_EVENT(hrtimer_expire_exit,
+BARNEY(hrtimer_expire_exit,
 
 	TP_PROTO(struct hrtimer *hrtimer),
 
@@ -252,7 +252,7 @@ TRACE_EVENT(hrtimer_expire_exit,
  * hrtimer_cancel - called when the hrtimer is canceled
  * @hrtimer:	pointer to struct hrtimer
  */
-TRACE_EVENT(hrtimer_cancel,
+BARNEY(hrtimer_cancel,
 
 	TP_PROTO(struct hrtimer *hrtimer),
 
@@ -276,7 +276,7 @@ TRACE_EVENT(hrtimer_cancel,
  *		zero, otherwise it is started
  * @expires:	the itimers expiry time
  */
-TRACE_EVENT(itimer_state,
+BARNEY(itimer_state,
 
 	TP_PROTO(int which, const struct itimerval *const value,
 		 cputime_t expires),
@@ -313,7 +313,7 @@ TRACE_EVENT(itimer_state,
  * @pid:	pid of the process which owns the timer
  * @now:	current time, used to calculate the latency of itimer
  */
-TRACE_EVENT(itimer_expire,
+BARNEY(itimer_expire,
 
 	TP_PROTO(int which, struct pid *pid, cputime_t now),
 
include/trace/events/workqueue.h +5 -5
index d6c9744..33077fb 100644
@@ -8,7 +8,7 @@
 #include <linux/sched.h>
 #include <linux/tracepoint.h>
 
-DECLARE_EVENT_CLASS(workqueue,
+FRED(workqueue,
 
 	TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
 
@@ -30,14 +30,14 @@ DECLARE_EVENT_CLASS(workqueue,
 		__entry->thread_pid, __entry->func)
 );
 
-DEFINE_EVENT(workqueue, workqueue_insertion,
+WILMA(workqueue, workqueue_insertion,
 
 	TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
 
 	TP_ARGS(wq_thread, work)
 );
 
-DEFINE_EVENT(workqueue, workqueue_execution,
+WILMA(workqueue, workqueue_execution,
 
 	TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
 
@@ -45,7 +45,7 @@ DEFINE_EVENT(workqueue, workqueue_execution,
 );
 
 /* Trace the creation of one workqueue thread on a cpu */
-TRACE_EVENT(workqueue_creation,
+BARNEY(workqueue_creation,
 
 	TP_PROTO(struct task_struct *wq_thread, int cpu),
 
@@ -67,7 +67,7 @@ TRACE_EVENT(workqueue_creation,
 		__entry->thread_pid, __entry->cpu)
 );
 
-TRACE_EVENT(workqueue_destruction,
+BARNEY(workqueue_destruction,
 
 	TP_PROTO(struct task_struct *wq_thread),
 
include/trace/ftrace.h +79 -79

325 lines not on this page · raw message

kernel/trace/trace.h +2 -2
index 1d7f483..568f0ad 100644
@@ -695,8 +695,8 @@ int tracing_update_buffers(void);
 
 /* trace event type bit fields, not numeric */
 enum {
-	TRACE_EVENT_TYPE_PRINTF		= 1,
-	TRACE_EVENT_TYPE_RAW		= 2,
+	BARNEY_TYPE_PRINTF		= 1,
+	BARNEY_TYPE_RAW		= 2,
 };
 
 struct ftrace_event_field {
kernel/trace/trace_output.h +2 -2
index 9d91c72..e2872d2 100644
@@ -1,5 +1,5 @@
-#ifndef __TRACE_EVENTS_H
-#define __TRACE_EVENTS_H
+#ifndef __BARNEYS_H
+#define __BARNEYS_H
 
 #include <linux/trace_seq.h>
 #include "trace.h"
net/mac80211/driver-trace.h +27 -27

210 lines not on this page · raw message

samples/trace_events/trace-events-sample.h +4 -4
index 6af3732..7a3beda 100644
@@ -32,8 +32,8 @@
  *
  * serves this purpose.
  */
-#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_EVENT_SAMPLE_H
+#if !defined(_BARNEY_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _BARNEY_SAMPLE_H
 
 /*
  * All trace headers should include tracepoint.h, until we finally
@@ -42,7 +42,7 @@
 #include <linux/tracepoint.h>
 
 /*
- * The TRACE_EVENT macro is broken up into 5 parts.
+ * The BARNEY macro is broken up into 5 parts.
  *
  * name: name of the trace point. This is also how to enable the tracepoint.
  *   A function called trace_foo_bar() will be created.
@@ -74,7 +74,7 @@
  * to the data structure in the ring buffer, and is defined by the
  * TP_STRUCT__entry.
  */
-TRACE_EVENT(foo_bar,
+BARNEY(foo_bar,
 
 	TP_PROTO(char *foo, int bar),
 
tools/perf/util/trace-event.h +3 -3
index dd51c68..90120ab 100644
@@ -1,5 +1,5 @@
-#ifndef __PERF_TRACE_EVENTS_H
-#define __PERF_TRACE_EVENTS_H
+#ifndef __PERF_BARNEYS_H
+#define __PERF_BARNEYS_H
 
 #include "parse-events.h"
 
@@ -259,4 +259,4 @@ enum trace_flag_type {
 	TRACE_FLAG_SOFTIRQ		= 0x10,
 };
 
-#endif /* __PERF_TRACE_EVENTS_H */
+#endif /* __PERF_BARNEYS_H */
Acked-by on v1 1/1
#36 lore raw

Re: [PATCH][tip/perf/core] tracing: Rename TRACE_EVENT and others to something resonable

Quoted 55 lines · Steven Rostedt

With the addition of TRACE_EVENT templates (or classes) the issue of naming has come up.

Originally, the template was called TRACE_EVENT_TEMPLATE. This was to be used to consolidate similar TRACE_EVENTs because a single TRACE_EVENT takes up quite a bit of code. One TRACE_EVENT creates a function to register and unregister a trace point, a function to record the event in a buffer, a function to display the binary output to user space, a function to add counters to record the number of times the event is reached, and so on.

All these functions creates a lot of bloat, especially since these functions are almost identical to each other. Unfortunately, these functions require specific parameters and structure fields, and can't always be the same. But for those events that share the same structure and parameters, a class/template allows them to share the same functions and this cuts down the bloat substantially.

But what to call these macros to satisfy the already confused kernel developers?

Ideally, DECLARE_EVENT_CLASS to create the class, DEFINE_EVENT to create an instance of the class, and even DEFINE_EVENT_CLASS to replace the current TRACE_EVENT that defines a class and creates an event of the same name as the class. New DEFINE_EVENTs may also reference a class declared by DEFINE_EVENT_CLASS.

But us kernel developers stay up too late at night, drinking jolt (or beer if you are in Europe), and our brain cells have fused to only logical circuitry, thus understanding concepts that are not engraved in stone becomes a bit too straining for us, and we may finally have to give up on solving this one last bug to get some rest with our love one that's been sleeping since 9pm.

This means using DECLARE_* and DEFINE_* will push us over that brink to normalcy and must be avoided. A new name must be established to clearly describe the mystical CPP magic that comprises the TRACE_EVENT hackery. Something that can bring us back to our roots. Something where it all begins. The stone age.

Thus, this patch renames the MACROS to the most obvious definitions around. Something we should have thought of at the start.

s/DEFINE_EVENT_CLASS/FRED/g
s/DEFINE_EVENT/WILMA/g
s/TRACE_EVENT/BARNEY/g

Thus with the new naming convention:

FRED(x, ...) -- will declare a class but will not make any events WILMA(x, y, ...) -- will create an event based off of class made by FRED BARNEY(x, ...) -- will create both a class and an event

Quoted 6 lines

/* Little known secret, WILMA can also fool around with BARNEY and can create new events with BARNEY as well as with FRED */

(apologies to Thomas Gleixner and his renaming to "fred")