From: Arjan van de Ven <arjan@infradead.org>
To: mingo@elte.hu
Cc: Arjan van de Ven <arjan@infradead.org>,
linux-kernel@vger.kernel.org, fweisbec@gmail.com,
peterz@infradead.org, Paul Mackerras <paulus@samba.org>
Subject: [PATCH] perf: Use a define for the maximum length of a trace event
Date: Sat, 19 Sep 2009 13:36:30 +0200 [thread overview]
Message-ID: <20090919133630.10533d3e@infradead.org> (raw)
In-Reply-To: <20090919133410.7b23e270@infradead.org>
From e5f5037ae4423c188aa68ee6ba239708bb720722 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 19 Sep 2009 13:21:20 +0200
Subject: [PATCH] perf: Use a define for the maximum length of a trace event
As per Ingo's review: use a #define rather than an open coded constant
for the maximum length of a trace event for storing in the perf.data file.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
| 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index ef91145..ed6b553 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -86,9 +86,10 @@ void perf_header__add_attr(struct perf_header *self,
self->attr[pos] = attr;
}
+#define MAX_EVENT_NAME 64
struct perf_trace_event_type {
u64 event_id;
- char name[64];
+ char name[MAX_EVENT_NAME];
};
static int event_count;
@@ -96,7 +97,7 @@ static struct perf_trace_event_type *events;
void perf_header__push_event(u64 id, const char *name)
{
- if (strlen(name) > 64)
+ if (strlen(name) > MAX_EVENT_NAME)
printf("Event %s will be truncated\n", name);
if (!events) {
@@ -110,7 +111,7 @@ void perf_header__push_event(u64 id, const char *name)
}
memset(&events[event_count], 0, sizeof(struct perf_trace_event_type));
events[event_count].event_id = id;
- strncpy(events[event_count].name, name, 63);
+ strncpy(events[event_count].name, name, MAX_EVENT_NAME - 1);
event_count++;
}
--
1.6.0.6
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2009-09-19 11:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-19 11:34 [git pull] incremental updates to timechart Arjan van de Ven
2009-09-19 11:34 ` [PATCH] perf: Add "perf timechart record" Arjan van de Ven
2009-09-19 17:00 ` [tip:perfcounters/core] perf timechart: " tip-bot for Arjan van de Ven
2009-09-19 11:35 ` [PATCH] perf: Be consistent about minimum text size in the svghelper Arjan van de Ven
2009-09-19 17:01 ` [tip:perfcounters/core] perf utils: " tip-bot for Arjan van de Ven
2009-09-19 11:35 ` [PATCH] trace: Move the end point of a C state in the power tracer Arjan van de Ven
2009-09-19 17:01 ` [tip:perfcounters/core] tracing, x86, cpuidle: " tip-bot for Arjan van de Ven
2009-09-19 11:36 ` [PATCH] perf: Add timechart help text and add timechart to "perf help" Arjan van de Ven
2009-09-19 17:01 ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-19 11:36 ` Arjan van de Ven [this message]
2009-09-19 17:01 ` [tip:perfcounters/core] perf utils: Use a define for the maximum length of a trace event 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=20090919133630.10533d3e@infradead.org \
--to=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®