public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: David Ahern <david.ahern@oracle.com>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH] perf tool: Add event name to error message for filters
Date: Tue, 24 Mar 2015 18:29:56 -0300	[thread overview]
Message-ID: <20150324212956.GB12599@kernel.org> (raw)
In-Reply-To: <1427213417-127183-1-git-send-email-david.ahern@oracle.com>

Em Tue, Mar 24, 2015 at 12:10:17PM -0400, David Ahern escreveu:
> Use of a bad filter currently generates the message:
>  Error: failed to set filter with 22 (Invalid argument)
> 
> Add the event name to make it clear to which event the filter
> failed to apply:
>   Error: Failed to set filter on event sched:sg_lb_stats: 22: Invalid argument
> 
> Signed-off-by: David Ahern <david.ahern@oracle.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>


> +++ b/tools/perf/util/evsel.c
> @@ -807,9 +807,19 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, int ncpus, int nthrea
>  int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
>  			   const char *filter)
>  {
> -	return perf_evsel__run_ioctl(evsel, ncpus, nthreads,
> -				     PERF_EVENT_IOC_SET_FILTER,
> -				     (void *)filter);
> +	int err;
> +	char msg[512];
> +
> +	err = perf_evsel__run_ioctl(evsel, ncpus, nthreads,
> +				    PERF_EVENT_IOC_SET_FILTER,
> +				    (void *)filter);
> +	if (err) {
> +		error("Failed to set filter on event %s: %d: %s\n",
> +		      perf_evsel__name(evsel), errno,
> +		      strerror_r(errno, msg, sizeof(msg)));

Humm, probably this will be the only call to error() from evsel.c,
making it require the error() routine, which in turn will break the
python binding, lemme check...

If that is the case we'll have to somehow propagate to the caller of
perf_evlist__apply_filters what was the evsel that had a filter that
caused the problem.

- Arnaldo

> +	}
> +
> +	return err;
>  }
>  
>  int perf_evsel__enable(struct perf_evsel *evsel, int ncpus, int nthreads)
> -- 
> 2.2.1

  reply	other threads:[~2015-03-24 21:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 16:10 [PATCH] perf tool: Add event name to error message for filters David Ahern
2015-03-24 21:29 ` Arnaldo Carvalho de Melo [this message]
2015-03-24 21:57   ` Arnaldo Carvalho de Melo
2015-03-24 22:00     ` David Ahern
2015-03-24 22:23       ` Arnaldo Carvalho de Melo
2015-03-25 11:19       ` Jiri Olsa

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=20150324212956.GB12599@kernel.org \
    --to=acme@kernel.org \
    --cc=david.ahern@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.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