public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Paul Mackerras <paulus@samba.org>,
	"K.Prasad" <prasad@linux.vnet.ibm.com>
Subject: [RFC Patch 5/5] PERF-HW_HBKPT: Display kernel symbol-name along with perf output
Date: Fri, 30 Oct 2009 03:52:40 +0530	[thread overview]
Message-ID: <20091029222240.GF14906@in.ibm.com> (raw)
In-Reply-To: 20091029220551.166918079@linux.vnet.ibm.com

[-- Attachment #1: perf_hbkpt_ksymname_05 --]
[-- Type: text/plain, Size: 3178 bytes --]

Enable the kernel symbol to be shown when perf statistics are reported. This
enables the user to quickly recognise the hit counter with the symbol to which
it corresponds to.

Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
---
 tools/perf/builtin-report.c    |    4 ++--
 tools/perf/util/parse-events.c |   18 +++++++++++-------
 tools/perf/util/parse-events.h |    2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)

Index: linux-2.6-tip.perf_hbkpt/tools/perf/util/parse-events.c
===================================================================
--- linux-2.6-tip.perf_hbkpt.orig/tools/perf/util/parse-events.c
+++ linux-2.6-tip.perf_hbkpt/tools/perf/util/parse-events.c
@@ -285,15 +285,14 @@ static char *event_cache_name(u8 cache_t
 
 const char *event_name(int counter)
 {
-	u64 config = attrs[counter].config;
-	int type = attrs[counter].type;
-
-	return __event_name(type, config);
+	return __event_name(&attrs[counter]);
 }
 
-const char *__event_name(int type, u64 config)
+const char *__event_name(const struct perf_event_attr *attr)
 {
-	static char buf[32];
+	int type = attr->type;
+	u64 config = attr->config;
+	static char buf[256];
 
 	if (type == PERF_TYPE_RAW) {
 		sprintf(buf, "raw 0x%llx", config);
@@ -336,7 +335,12 @@ const char *__event_name(int type, u64 c
 		return tracepoint_id_to_name(config);
 
 	case PERF_TYPE_BREAKPOINT:
-		return hbp_event_names[config];
+		/*
+		 * Separate the breakpoint event from the kernel symbol
+		 * using a ":" symbol
+		 */
+		sprintf(buf, "%s:%s", hbp_event_names[config], attr->ksym_name);
+			return buf;
 
 	default:
 		break;
Index: linux-2.6-tip.perf_hbkpt/tools/perf/util/parse-events.h
===================================================================
--- linux-2.6-tip.perf_hbkpt.orig/tools/perf/util/parse-events.h
+++ linux-2.6-tip.perf_hbkpt/tools/perf/util/parse-events.h
@@ -20,7 +20,7 @@ extern struct perf_event_attr attrs[MAX_
 extern char *filters[MAX_COUNTERS];
 
 extern const char *event_name(int ctr);
-extern const char *__event_name(int type, u64 config);
+extern const char *__event_name(const struct perf_event_attr *attr);
 
 extern int parse_events(const struct option *opt, const char *str, int unset);
 extern int parse_filter(const struct option *opt, const char *str, int unset);
Index: linux-2.6-tip.perf_hbkpt/tools/perf/builtin-report.c
===================================================================
--- linux-2.6-tip.perf_hbkpt.orig/tools/perf/builtin-report.c
+++ linux-2.6-tip.perf_hbkpt/tools/perf/builtin-report.c
@@ -849,7 +849,7 @@ process_read_event(event_t *event, unsig
 	attr = perf_header__find_attr(event->read.id, header);
 
 	if (show_threads) {
-		const char *name = attr ? __event_name(attr->type, attr->config)
+		const char *name = attr ? __event_name(attr)
 				   : "unknown";
 		perf_read_values_add_value(&show_threads_values,
 					   event->read.pid, event->read.tid,
@@ -863,7 +863,7 @@ process_read_event(event_t *event, unsig
 			(void *)(long)(event->header.size),
 			event->read.pid,
 			event->read.tid,
-			attr ? __event_name(attr->type, attr->config)
+			attr ? __event_name(attr)
 			     : "FAIL",
 			event->read.value);
 


      parent reply	other threads:[~2009-10-29 22:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091029220551.166918079@linux.vnet.ibm.com>
2009-10-29 22:21 ` [RFC Patch 1/5] PERF-HW_BKPT: Allow per-cpu kernel-space Hardware Breakpoint requests K.Prasad
2009-10-29 22:21 ` [RFC Patch 2/5] PERF-HW_BKPT: Enable/disable the breakpoints when still registered K.Prasad
2009-10-29 22:21 ` [RFC Patch 3/5] PERF-HW_BKPT: Fix traceback seen when resuming after suspend-to-ram K.Prasad
2009-10-29 22:22 ` [RFC Patch 4/5] PERF-HW_HBKPT: Enable perf-events to use hw-breakpoints K.Prasad
2009-11-22  2:52   ` Frederic Weisbecker
2009-11-22  4:08     ` Frederic Weisbecker
2009-10-29 22:22 ` K.Prasad [this message]

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=20091029222240.GF14906@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=stern@rowland.harvard.edu \
    /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