From: tip-bot for Tom Zanussi <tzanussi@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
tzanussi@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/scripting] perf trace: Add flag/symbolic format_flags
Date: Mon, 30 Nov 2009 08:22:02 GMT [thread overview]
Message-ID: <tip-eb9a42caa7a926beb935a22bc59d981b35f0b652@git.kernel.org> (raw)
In-Reply-To: <1259133352-23685-3-git-send-email-tzanussi@gmail.com>
Commit-ID: eb9a42caa7a926beb935a22bc59d981b35f0b652
Gitweb: http://git.kernel.org/tip/eb9a42caa7a926beb935a22bc59d981b35f0b652
Author: Tom Zanussi <tzanussi@gmail.com>
AuthorDate: Wed, 25 Nov 2009 01:15:47 -0600
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 28 Nov 2009 10:04:25 +0100
perf trace: Add flag/symbolic format_flags
It's useful to know whether a field is a flag or symbolic field
for e.g. when generating scripts - it allows us to translate
those fields specially rather than literally as plain numeric
values.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: fweisbec@gmail.com
Cc: rostedt@goodmis.org
Cc: anton@samba.org
Cc: hch@infradead.org
LKML-Reference: <1259133352-23685-3-git-send-email-tzanussi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/trace-event-parse.c | 17 +++++++++++++++++
tools/perf/util/trace-event.h | 2 ++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 7021dc1..85d7163 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -48,6 +48,11 @@ static unsigned long long input_buf_siz;
static int cpus;
static int long_size;
+static int is_flag_field;
+static int is_symbolic_field;
+
+static struct format_field *
+find_any_field(struct event *event, const char *name);
static void init_input_buf(char *buf, unsigned long long size)
{
@@ -1301,6 +1306,16 @@ process_entry(struct event *event __unused, struct print_arg *arg,
arg->type = PRINT_FIELD;
arg->field.name = field;
+ if (is_flag_field) {
+ arg->field.field = find_any_field(event, arg->field.name);
+ arg->field.field->flags |= FIELD_IS_FLAG;
+ is_flag_field = 0;
+ } else if (is_symbolic_field) {
+ arg->field.field = find_any_field(event, arg->field.name);
+ arg->field.field->flags |= FIELD_IS_SYMBOLIC;
+ is_symbolic_field = 0;
+ }
+
type = read_token(&token);
*tok = token;
@@ -1668,9 +1683,11 @@ process_arg_token(struct event *event, struct print_arg *arg,
type = process_entry(event, arg, &token);
} else if (strcmp(token, "__print_flags") == 0) {
free_token(token);
+ is_flag_field = 1;
type = process_flags(event, arg, &token);
} else if (strcmp(token, "__print_symbolic") == 0) {
free_token(token);
+ is_symbolic_field = 1;
type = process_symbols(event, arg, &token);
} else if (strcmp(token, "__get_str") == 0) {
free_token(token);
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index e7aaf00..aeb9157 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -29,6 +29,8 @@ enum format_flags {
FIELD_IS_SIGNED = 4,
FIELD_IS_STRING = 8,
FIELD_IS_DYNAMIC = 16,
+ FIELD_IS_FLAG = 32,
+ FIELD_IS_SYMBOLIC = 64,
};
struct format_field {
next prev parent reply other threads:[~2009-11-30 8:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 7:15 [RFC][PATCH 0/7] perf trace: general-purpose scripting support, v2 Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 1/7] perf trace: Add scripting ops Tom Zanussi
2009-11-30 8:21 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 2/7] perf trace: Add flag/symbolic format_flags Tom Zanussi
2009-11-30 8:22 ` tip-bot for Tom Zanussi [this message]
2009-11-25 7:15 ` [RFC][PATCH 3/7] perf trace: Add Perl scripting support Tom Zanussi
2009-11-30 8:22 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 4/7] perf trace: Add perf trace scripting support modules for Perl Tom Zanussi
2009-11-30 8:22 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 5/7] perf trace: Add interface to access perf data from Perl handlers Tom Zanussi
2009-11-30 8:22 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 6/7] perf trace: Add Documentation for perf trace Perl support Tom Zanussi
2009-11-30 8:23 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 7:15 ` [RFC][PATCH 7/7] perf trace: Add a scripts/perl/bin for perf trace shell scripts Tom Zanussi
2009-11-30 8:23 ` [tip:perf/scripting] " tip-bot for Tom Zanussi
2009-11-25 8:28 ` [RFC][PATCH 0/7] perf trace: general-purpose scripting support, v2 Peter Zijlstra
2009-11-25 9:38 ` Peter Zijlstra
2009-11-25 9:43 ` Ingo Molnar
2009-11-25 9:58 ` Peter Zijlstra
2009-11-25 10:00 ` Peter Zijlstra
2009-11-28 9:14 ` Ingo Molnar
2009-11-30 7:17 ` Tom Zanussi
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=tip-eb9a42caa7a926beb935a22bc59d981b35f0b652@git.kernel.org \
--to=tzanussi@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@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