linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung.kim@lge.com>
To: undisclosed-recipients:;
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 1/2] perf evlist: Return first evsel for non-sample event on old kernel
Date: Thu, 23 Feb 2012 11:21:35 +0900	[thread overview]
Message-ID: <4F45A2AF.8050003@lge.com> (raw)
In-Reply-To: <1329702447-25045-1-git-send-email-namhyung.kim@lge.com>

Ping. :)


2012-02-20 10:47 AM, Namhyung Kim wrote:
> On old kernels that don't support sample_id_all feature,
> perf_evlist__id2evsel() returns NULL for non-sampling events.
> This breaks perf top when multiple events are given on command
> line. Fix it by using first evsel in the evlist. This will also
> prevent getting the same (potential) problem in such new tool/
> old kernel combo.
>
> Suggested-by: Arnaldo Carvalho de Melo<acme@ghostprotocols.net>
> Signed-off-by: Namhyung Kim<namhyung.kim@lge.com>
> ---
>   tools/perf/util/evlist.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 5c61dc57d7c7..f8da9fada002 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
>   	hlist_for_each_entry(sid, pos, head, node)
>   		if (sid->id == id)
>   			return sid->evsel;
> +
> +	if (!perf_evlist__sample_id_all(evlist))
> +		return list_entry(evlist->entries.next, struct perf_evsel, node);
> +
>   	return NULL;
>   }
>


  parent reply	other threads:[~2012-02-23  2:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  1:47 [PATCH RESEND 1/2] perf evlist: Return first evsel for non-sample event on old kernel Namhyung Kim
2012-02-20  1:47 ` [PATCH RESEND 2/2] perf tools: Add error message for EMFILE Namhyung Kim
2012-02-23  2:21 ` Namhyung Kim [this message]
2012-03-02  9:49 ` [tip:perf/urgent] perf evlist: Return first evsel for non-sample event on old kernel tip-bot for Namhyung Kim

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=4F45A2AF.8050003@lge.com \
    --to=namhyung.kim@lge.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --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;
as well as URLs for NNTP newsgroup(s).