From: Ingo Molnar <mingo@elte.hu>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com, peterz@infradead.org
Subject: Re: [PATCH 2/8] perf: Store trace event name/id pairs in perf.data
Date: Sat, 19 Sep 2009 11:31:37 +0200 [thread overview]
Message-ID: <20090919093137.GA456@elte.hu> (raw)
In-Reply-To: <20090912130405.6960d099@infradead.org>
* Arjan van de Ven <arjan@infradead.org> wrote:
> From c9d9dfc617df7a6a6029feb486f2433b7d825ef4 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Sat, 12 Sep 2009 07:52:51 +0200
> Subject: [PATCH] perf: Store trace event name/id pairs in perf.data
>
> The trace event name<->id mapping is dynamic for each kernel compile.
> In order for perf.data to be useable outside the actual system, we thus
> need to store a table of this mapping for later use.
>
> This patch adds this table to perf.data, and provides helper functions
> for lookup up fields from this table.
>
> To avoid mistakes, lookup-from-table is kept completely seprate from
> lookup-from-local-debugfs.
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
> tools/perf/util/header.c | 59 ++++++++++++++++++++++++++++++++++++++++
> tools/perf/util/header.h | 6 ++++
> tools/perf/util/parse-events.c | 25 +++++++++++++++++
> 3 files changed, 90 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index ec4d4c2..ef91145 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -86,6 +86,44 @@ void perf_header__add_attr(struct perf_header *self,
> self->attr[pos] = attr;
> }
>
> +struct perf_trace_event_type {
> + u64 event_id;
> + char name[64];
> +};
> +
> +static int event_count;
> +static struct perf_trace_event_type *events;
> +
> +void perf_header__push_event(u64 id, const char *name)
> +{
> + if (strlen(name) > 64)
> + printf("Event %s will be truncated\n", name);
> +
> + if (!events) {
> + events = malloc(sizeof(struct perf_trace_event_type));
> + if (!events)
> + die("nomem");
> + } else {
> + events = realloc(events, (event_count + 1) * sizeof(struct perf_trace_event_type));
> + if (!events)
> + die("nomem");
> + }
> + memset(&events[event_count], 0, sizeof(struct perf_trace_event_type));
> + events[event_count].event_id = id;
> + strncpy(events[event_count].name, name, 63);
> + event_count++;
This has the string length limit '64' embedded in 3 open-coded forms...
Ingo
next prev parent reply other threads:[~2009-09-19 9:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090912130306.5d0086ea@infradead.org>
2009-09-12 11:03 ` [PATCH 1/8] perf: Add a timestamp to fork events Arjan van de Ven
2009-09-19 9:51 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:04 ` [PATCH 2/8] perf: Store trace event name/id pairs in perf.data Arjan van de Ven
2009-09-19 9:31 ` Ingo Molnar [this message]
2009-09-19 9:51 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:04 ` [PATCH 3/8] perf: Allow perf utilities to have "callback" options without arguments Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:05 ` [PATCH 4/8] perf: Add a sample_event type to the event_union Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:05 ` [PATCH 5/8] trace: Convert the power tracer into an event tracer Arjan van de Ven
2009-09-15 3:43 ` Li Zefan
2009-09-15 4:16 ` Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] tracing, perf: " tip-bot for Arjan van de Ven
2009-09-12 11:06 ` [PATCH 6/8] perf: Add a SVG helper library file Arjan van de Ven
2009-09-19 9:52 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-12 11:06 ` [PATCH 7/8] perf: Add a perf record --timechart option Arjan van de Ven
2009-09-14 8:06 ` Peter Zijlstra
2009-09-14 20:33 ` Arjan van de Ven
2009-09-19 9:44 ` Ingo Molnar
2009-09-19 11:03 ` [PATCH] perf: Add "perf timechart record" Arjan van de Ven
2009-09-12 11:07 ` [PATCH 8/8] perf: Add the timechart tool Arjan van de Ven
2009-09-19 9:48 ` Ingo Molnar
2009-09-19 9:51 ` Ingo Molnar
2009-09-19 9:53 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
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=20090919093137.GA456@elte.hu \
--to=mingo@elte.hu \
--cc=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox