linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Steven Rostedt <srostedt@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Borislav Petkov <bp@alien8.de>, Jiri Olsa <jolsa@redhat.com>,
	Arun Sharma <asharma@fb.com>, Namhyung Kim <namhyung.kim@lge.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 04/15] events: Update tools/lib/traceevent to work with perf
Date: Fri,  6 Apr 2012 00:47:55 +0200	[thread overview]
Message-ID: <1333666086-6517-5-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1333666086-6517-1-git-send-email-fweisbec@gmail.com>

From: Steven Rostedt <srostedt@redhat.com>

Some of the util functions of libtraceevent.a conflict with perf,
such as die(), warning() and others. Move them into event-util.h
that is not included by the perf tools.

Also, as perf compiles with 'bool' the filter_arg->bool needs to
be renamed to filter_arg->boolean.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 tools/lib/traceevent/event-parse.c  |    1 +
 tools/lib/traceevent/event-parse.h  |   20 +++-----------------
 tools/lib/traceevent/event-utils.h  |   16 ++++++++++++++++
 tools/lib/traceevent/parse-filter.c |   32 ++++++++++++++++----------------
 tools/lib/traceevent/trace-seq.c    |    1 +
 5 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 47a3227..3ce75b5 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -33,6 +33,7 @@
 #include <errno.h>
 
 #include "event-parse.h"
+#include "event-utils.h"
 
 static const char *input_buf;
 static unsigned long long input_buf_ptr;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index c32d715..2e0222d 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -167,6 +167,8 @@ enum format_flags {
 	FIELD_IS_STRING		= 8,
 	FIELD_IS_DYNAMIC	= 16,
 	FIELD_IS_LONG		= 32,
+	FIELD_IS_FLAG		= 64,
+	FIELD_IS_SYMBOLIC	= 128,
 };
 
 struct format_field {
@@ -406,22 +408,6 @@ struct pevent {
 	struct event_format *last_event;
 };
 
-/* Can be overridden */
-void die(const char *fmt, ...);
-void *malloc_or_die(unsigned int size);
-void warning(const char *fmt, ...);
-void pr_stat(const char *fmt, ...);
-void vpr_stat(const char *fmt, va_list ap);
-
-/* Always available */
-void __die(const char *fmt, ...);
-void __warning(const char *fmt, ...);
-void __pr_stat(const char *fmt, ...);
-
-void __vdie(const char *fmt, ...);
-void __vwarning(const char *fmt, ...);
-void __vpr_stat(const char *fmt, ...);
-
 static inline unsigned short
 __data2host2(struct pevent *pevent, unsigned short data)
 {
@@ -734,7 +720,7 @@ struct filter_arg_str {
 struct filter_arg {
 	enum filter_arg_type	type;
 	union {
-		struct filter_arg_boolean	bool;
+		struct filter_arg_boolean	boolean;
 		struct filter_arg_field		field;
 		struct filter_arg_value		value;
 		struct filter_arg_op		op;
diff --git a/tools/lib/traceevent/event-utils.h b/tools/lib/traceevent/event-utils.h
index a8fb48f..0829638 100644
--- a/tools/lib/traceevent/event-utils.h
+++ b/tools/lib/traceevent/event-utils.h
@@ -23,6 +23,22 @@
 
 #include <ctype.h>
 
+/* Can be overridden */
+void die(const char *fmt, ...);
+void *malloc_or_die(unsigned int size);
+void warning(const char *fmt, ...);
+void pr_stat(const char *fmt, ...);
+void vpr_stat(const char *fmt, va_list ap);
+
+/* Always available */
+void __die(const char *fmt, ...);
+void __warning(const char *fmt, ...);
+void __pr_stat(const char *fmt, ...);
+
+void __vdie(const char *fmt, ...);
+void __vwarning(const char *fmt, ...);
+void __vpr_stat(const char *fmt, ...);
+
 static inline char *strim(char *string)
 {
 	char *ret;
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 1df9966..fe37182 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -359,7 +359,7 @@ create_arg_item(struct event_format *event,
 			if (strcmp(token, COMM) != 0) {
 				/* not a field, Make it false */
 				arg->type = FILTER_ARG_BOOLEAN;
-				arg->bool.value = FILTER_FALSE;
+				arg->boolean.value = FILTER_FALSE;
 				break;
 			}
 			/* If token is 'COMM' then it is special */
@@ -487,7 +487,7 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 				free_arg(left);
 				free_arg(arg);
 				op->type = FILTER_ARG_BOOLEAN;
-				op->bool.value = FILTER_FALSE;
+				op->boolean.value = FILTER_FALSE;
 				break;
 			}
 
@@ -772,7 +772,7 @@ enum filter_vals test_arg(struct filter_arg *parent, struct filter_arg *arg)
 
 		/* bad case */
 	case FILTER_ARG_BOOLEAN:
-		return FILTER_VAL_FALSE + arg->bool.value;
+		return FILTER_VAL_FALSE + arg->boolean.value;
 
 		/* good cases: */
 	case FILTER_ARG_STR:
@@ -871,7 +871,7 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg)
 		free_arg(arg);
 		arg = allocate_arg();
 		arg->type = FILTER_ARG_BOOLEAN;
-		arg->bool.value = ret == FILTER_VAL_TRUE;
+		arg->boolean.value = ret == FILTER_VAL_TRUE;
 	}
 
 	return arg;
@@ -1116,7 +1116,7 @@ process_event(struct event_format *event, const char *filter_str,
 	if (!*parg) {
 		*parg = allocate_arg();
 		(*parg)->type = FILTER_ARG_BOOLEAN;
-		(*parg)->bool.value = FILTER_FALSE;
+		(*parg)->boolean.value = FILTER_FALSE;
 	}
 
 	return 0;
@@ -1139,7 +1139,7 @@ static int filter_event(struct event_filter *filter,
 		/* just add a TRUE arg */
 		arg = allocate_arg();
 		arg->type = FILTER_ARG_BOOLEAN;
-		arg->bool.value = FILTER_TRUE;
+		arg->boolean.value = FILTER_TRUE;
 	}
 
 	filter_type = add_filter_type(filter, event->id);
@@ -1369,9 +1369,9 @@ static int copy_filter_type(struct event_filter *filter,
 		arg = allocate_arg();
 		arg->type = FILTER_ARG_BOOLEAN;
 		if (strcmp(str, "TRUE") == 0)
-			arg->bool.value = 1;
+			arg->boolean.value = 1;
 		else
-			arg->bool.value = 0;
+			arg->boolean.value = 0;
 
 		filter_type = add_filter_type(filter, event->id);
 		filter_type->filter = arg;
@@ -1442,8 +1442,8 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
 		arg = filter_type->filter;
 		if (arg->type != FILTER_ARG_BOOLEAN)
 			continue;
-		if ((arg->bool.value && type == FILTER_TRIVIAL_FALSE) ||
-		    (!arg->bool.value && type == FILTER_TRIVIAL_TRUE))
+		if ((arg->boolean.value && type == FILTER_TRIVIAL_FALSE) ||
+		    (!arg->boolean.value && type == FILTER_TRIVIAL_TRUE))
 			continue;
 
 		event = filter_type->event;
@@ -1497,10 +1497,10 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
 			continue;
 		switch (type) {
 		case FILTER_TRIVIAL_FALSE:
-			if (filter_type->filter->bool.value)
+			if (filter_type->filter->boolean.value)
 				continue;
 		case FILTER_TRIVIAL_TRUE:
-			if (!filter_type->filter->bool.value)
+			if (!filter_type->filter->boolean.value)
 				continue;
 		default:
 			break;
@@ -1551,10 +1551,10 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
 
 	switch (type) {
 	case FILTER_TRIVIAL_FALSE:
-		return !filter_type->filter->bool.value;
+		return !filter_type->filter->boolean.value;
 
 	case FILTER_TRIVIAL_TRUE:
-		return filter_type->filter->bool.value;
+		return filter_type->filter->boolean.value;
 	default:
 		return 1;
 	}
@@ -1783,7 +1783,7 @@ static int test_filter(struct event_format *event,
 	switch (arg->type) {
 	case FILTER_ARG_BOOLEAN:
 		/* easy case */
-		return arg->bool.value;
+		return arg->boolean.value;
 
 	case FILTER_ARG_OP:
 		return test_op(event, arg, record);
@@ -2147,7 +2147,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg)
 	switch (arg->type) {
 	case FILTER_ARG_BOOLEAN:
 		str = malloc_or_die(6);
-		if (arg->bool.value)
+		if (arg->boolean.value)
 			strcpy(str, "TRUE");
 		else
 			strcpy(str, "FALSE");
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
index d2f265b..b1ccc92 100644
--- a/tools/lib/traceevent/trace-seq.c
+++ b/tools/lib/traceevent/trace-seq.c
@@ -24,6 +24,7 @@
 #include <stdarg.h>
 
 #include "event-parse.h"
+#include "event-utils.h"
 
 /*
  * The TRACE_SEQ_POISON is to catch the use of using
-- 
1.7.5.4


  parent reply	other threads:[~2012-04-05 22:48 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 22:47 [RFC][PATCH 00/15] tools: Unify perf and trace-cmd trace event format parsing v2 Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 01/15] perf: Separate out trace-cmd parse-events from perf files Frederic Weisbecker
2012-04-06 11:36   ` Borislav Petkov
2012-04-06 15:23     ` Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 02/15] tools/events: Add files to create libtraceevent.a Frederic Weisbecker
2012-04-06  0:08   ` David Ahern
2012-04-06  0:18     ` Steven Rostedt
2012-04-06  0:24       ` David Ahern
2012-04-06 11:40   ` Borislav Petkov
2012-04-06 13:21   ` Borislav Petkov
2012-04-06 22:15     ` Steven Rostedt
2012-04-07  9:08       ` Borislav Petkov
2012-04-11 15:20   ` Arnaldo Carvalho de Melo
2012-04-11 15:38     ` Steven Rostedt
2012-04-11 17:47       ` Frederic Weisbecker
2012-04-11 17:54       ` Arnaldo Carvalho de Melo
2012-04-05 22:47 ` [PATCH 03/15] perf: Build libtraceevent.a Frederic Weisbecker
2012-04-06 11:45   ` Borislav Petkov
2012-04-06 15:26     ` Frederic Weisbecker
2012-04-06 15:51       ` Borislav Petkov
2012-04-09 17:10         ` Frederic Weisbecker
2012-04-05 22:47 ` Frederic Weisbecker [this message]
2012-04-06 11:48   ` [PATCH 04/15] events: Update tools/lib/traceevent to work with perf Borislav Petkov
2012-04-09 17:11     ` Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 05/15] perf: Have perf use the new libtraceevent.a library Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 06/15] perf/events: Add flag to produce nsec output Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 07/15] perf/events: Add flag/symbol format_flags Frederic Weisbecker
2012-04-05 22:47 ` [PATCH 08/15] perf/events: Correct size given to memset Frederic Weisbecker
2012-04-06 11:24   ` Borislav Petkov
2012-04-06 12:00     ` Borislav Petkov
2012-04-06 12:27       ` Steven Rostedt
2012-04-05 22:48 ` [PATCH 09/15] parse-events: Handle invalid opcode parsing gracefully Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 10/15] parse-events: Handle opcode parsing error Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 11/15] parse-events: Let pevent_free() take a NULL pointer Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 12/15] parse-events: Support '+' opcode in print format Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 13/15] parse-events: Allow '*' and '/' operations in TP_printk Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 14/15] parse-event: Fix memset pointer size bug in handle Frederic Weisbecker
2012-04-05 22:48 ` [PATCH 15/15] parse-events: Rename struct record to struct pevent_record Frederic Weisbecker
2012-04-06  3:07 ` [RFC][PATCH 00/15] tools: Unify perf and trace-cmd trace event format parsing v2 David Sharp
2012-04-06 15:11   ` Frederic Weisbecker
2012-04-09 10:13 ` Namhyung Kim
2012-04-23 14:47 ` Our failure on tracing tools unification (Was: Re: [RFC][PATCH 00/15] tools: Unify perf and trace-cmd trace event format parsing v2) Frederic Weisbecker
2012-04-23 15:08   ` Peter Zijlstra
2012-04-23 15:31     ` Steven Rostedt
2012-04-23 16:07       ` Borislav Petkov
2012-04-24  9:10     ` Thomas Gleixner
2012-04-25  8:05     ` Ingo Molnar
2012-04-25 12:39       ` Frederic Weisbecker
2012-04-25 14:19       ` Our failure on tracing tools unification Frank Ch. Eigler
2012-04-25 16:37         ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2012-04-25 12:26 [PATCH 00/15] tools: Unify perf and trace-cmd trace event format parsing v3 Frederic Weisbecker
2012-04-25 12:26 ` [PATCH 04/15] events: Update tools/lib/traceevent to work with perf Frederic Weisbecker

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1333666086-6517-5-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=acme@infradead.org \
    --cc=asharma@fb.com \
    --cc=bp@alien8.de \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

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

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