public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brice Goglin <Brice.Goglin@inria.fr>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>,
	paulus@samba.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [perf] howto switch from pfmon
Date: Thu, 06 Aug 2009 21:01:57 +0200	[thread overview]
Message-ID: <4A7B28A5.2010605@inria.fr> (raw)
In-Reply-To: <1249580428.4975.14.camel@laptop>

Tested-by: Brice Goglin <Brice.Goglin@inria.fr>

This one and the next patch made the trick.



Peter Zijlstra wrote:
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 8cb58d6..c053fd8 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -112,7 +112,9 @@ struct read_event {
>  	struct perf_event_header header;
>  	u32 pid,tid;
>  	u64 value;
> -	u64 format[3];
> +	u64 time_enabled;
> +	u64 time_running;
> +	u64 id;
>  };
>  
>  typedef union event_union {
> @@ -1690,14 +1692,37 @@ static void trace_event(event_t *event)
>  	dprintf(".\n");
>  }
>  
> +static struct perf_header	*header;
> +
> +static struct perf_counter_attr *perf_header__find_attr(u64 id)
> +{
> +	int i;
> +
> +	for (i = 0; i < header->attrs; i++) {
> +		struct perf_header_attr *attr = header->attr[i];
> +		int j;
> +
> +		for (j = 0; j < attr->ids; j++) {
> +			if (attr->id[j] == id)
> +				return &attr->attr;
> +		}
> +	}
> +
> +	return NULL;
> +}
> +
>  static int
>  process_read_event(event_t *event, unsigned long offset, unsigned long head)
>  {
> -	dprintf("%p [%p]: PERF_EVENT_READ: %d %d %Lu\n",
> +	struct perf_counter_attr *attr = perf_header__find_attr(event->read.id);
> +
> +	dprintf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n",
>  			(void *)(offset + head),
>  			(void *)(long)(event->header.size),
>  			event->read.pid,
>  			event->read.tid,
> +			attr ? __event_name(attr->type, attr->config)
> +			     : "FAIL",
>  			event->read.value);
>  
>  	return 0;
> @@ -1743,8 +1768,6 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
>  	return 0;
>  }
>  
> -static struct perf_header	*header;
> -
>  static u64 perf_header__sample_type(void)
>  {
>  	u64 sample_type = 0;
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 7bdad8d..4858d83 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -223,9 +239,15 @@ char *event_name(int counter)
>  {
>  	u64 config = attrs[counter].config;
>  	int type = attrs[counter].type;
> +
> +	return __event_name(type, config);
> +}
> +
> +char *__event_name(int type, u64 config)
> +{
>  	static char buf[32];
>  
> -	if (attrs[counter].type == PERF_TYPE_RAW) {
> +	if (type == PERF_TYPE_RAW) {
>  		sprintf(buf, "raw 0x%llx", config);
>  		return buf;
>  	}
> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
> index 1ea5d09..192a962 100644
> --- a/tools/perf/util/parse-events.h
> +++ b/tools/perf/util/parse-events.h
> @@ -10,6 +10,7 @@ extern int			nr_counters;
>  extern struct perf_counter_attr attrs[MAX_COUNTERS];
>  
>  extern char *event_name(int ctr);
> +extern char *__event_name(int type, u64 config);
>  
>  extern int parse_events(const struct option *opt, const char *str, int unset);
>  
>
>
>   


  parent reply	other threads:[~2009-08-06 19:01 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 20:54 [perf] howto switch from pfmon Brice Goglin
2009-06-23 12:12 ` Andi Kleen
2009-06-23 12:23   ` Peter Zijlstra
2009-06-23 13:57   ` Ingo Molnar
2009-06-23 13:14 ` Ingo Molnar
2009-06-23 13:22   ` Peter Zijlstra
2009-06-23 13:38     ` Ingo Molnar
2009-06-23 13:25   ` Ingo Molnar
2009-06-23 13:47   ` Ingo Molnar
2009-06-23 14:00     ` Brice Goglin
2009-06-23 14:36       ` Ingo Molnar
2009-06-23 15:22         ` Brice Goglin
2009-06-29 19:29           ` Ingo Molnar
2009-08-06 16:59             ` Brice Goglin
2009-08-06 17:40               ` Peter Zijlstra
2009-08-06 17:48                 ` Brice Goglin
2009-08-06 17:59                   ` Peter Zijlstra
2009-08-06 18:57                   ` [PATCH] perf tools: Fix reading of perf.data file header Peter Zijlstra
2009-08-06 19:03                     ` Brice Goglin
2009-08-06 19:59                       ` Ingo Molnar
2009-08-06 20:03                         ` Brice Goglin
2009-08-06 23:35                         ` Brice Goglin
2009-08-07  6:13                           ` Brice Goglin
2009-08-07  6:32                           ` Ingo Molnar
2009-08-07  7:38                             ` Brice Goglin
2009-08-07  7:45                               ` Ingo Molnar
2009-08-07  8:18                                 ` Brice Goglin
2009-08-07  8:23                                   ` Ingo Molnar
2009-08-07  8:27                                   ` Ingo Molnar
2009-08-07  8:30                                   ` [tip:perfcounters/core] perf stat: Rename -S/--scale to -c/--scale tip-bot for Brice Goglin
2009-08-07 11:55                             ` [PATCH] perf report: Display per-thread event counters Brice Goglin
2009-08-08 11:54                               ` [tip:perfcounters/core] perf report: Fix and improve the displaying of " tip-bot for Brice Goglin
2009-08-08 12:14                               ` [PATCH] perf report: Display " Ingo Molnar
2009-08-08 16:10                                 ` Brice Goglin
2009-08-08 16:13                                   ` Ingo Molnar
2009-08-07  6:37                     ` [tip:perfcounters/urgent] perf tools: Fix multi-counter stat bug caused by incorrect reading of perf.data file header tip-bot for Peter Zijlstra
2009-08-07  7:39                     ` tip-bot for Peter Zijlstra
2009-08-06 19:01                 ` Brice Goglin [this message]
2009-06-23 14:21   ` [perf] howto switch from pfmon Brice Goglin
2009-06-23 14:51     ` Ingo Molnar
2009-06-23 15:29       ` Jaswinder Singh Rajput

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=4A7B28A5.2010605@inria.fr \
    --to=brice.goglin@inria.fr \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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