All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH 5/7] perf tools: Introduce perf_target__strerror()
Date: Mon, 7 May 2012 14:29:46 -0300	[thread overview]
Message-ID: <20120507172946.GC2485@infradead.org> (raw)
In-Reply-To: <1336367344-28071-6-git-send-email-namhyung.kim@lge.com>

Em Mon, May 07, 2012 at 02:09:02PM +0900, Namhyung Kim escreveu:
> The perf_target__strerror() sets @buf to a string that
> describes the (perf_target-specific) error condition
> that is passed via @errnum.
> 
> This is similar to strerror_r() and does same thing if
> @errnum has a standard errno value.

This has a problem: why should I be warned when I do, as root:

# perf top -u acme

It warns me that "UID switch overriding SYSTEM", yeah, right that is
what I asked, no need to tell me that :-)

So what is missing in this case is that top starts with system_wide set,
not from the command line.

I.e. if I had asked for:

# perf top --system_wide --user acme

Ok, the warning would make sense.

So just special case this in the top case, I think, like the patch
below, ack?

I'll fold this into this patch and add a [ committer note: ... ]

Ack?

- Arnaldo

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a2518fc..780791f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1257,7 +1257,16 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	setup_browser(false);
 
 	status = perf_target__validate(&top.target);
-	if (status != PERF_ERRNO_TARGET__SUCCESS) {
+	if (status != PERF_ERRNO_TARGET__SUCCESS &&
+	    status != PERF_ERRNO_TARGET__PID_OVERRIDE_SYSTEM &&
+	    status != PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM) {
+		/*
+ 		 * Top doesn't provide an explicit way to ask for system wide
+ 		 * profiling, it is the default.
+ 		 *
+ 		 * So we shouldn't warn the user when he/she asks for --pid or
+ 		 * --uid.
+ 		 */
 		perf_target__strerror(&top.target, status, errbuf, BUFSIZ);
 		ui__warning("%s", errbuf);
 	}

  reply	other threads:[~2012-05-07 17:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07  5:08 [PATCH 0/7] perf tools: Fix cpu/thread map handling v3 Namhyung Kim
2012-05-07  5:08 ` [PATCH 1/7] perf top: Defaults to system_wide target Namhyung Kim
2012-05-07  5:08 ` [PATCH 2/7] perf evlist: Fix creation of cpu map Namhyung Kim
2012-05-11  6:39   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 3/7] perf target: Introduce perf_target_errno Namhyung Kim
2012-05-11  6:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 4/7] perf target: Introduce perf_target__parse_uid() Namhyung Kim
2012-05-11  6:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 5/7] perf tools: Introduce perf_target__strerror() Namhyung Kim
2012-05-07 17:29   ` Arnaldo Carvalho de Melo [this message]
2012-05-07 17:43     ` David Ahern
2012-05-08  1:57       ` Namhyung Kim
2012-05-08 13:17         ` Arnaldo Carvalho de Melo
2012-05-11  6:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 6/7] perf target: Consolidate target task/cpu checking Namhyung Kim
2012-05-11  6:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 7/7] perf stat: Use perf_evlist__create_maps Namhyung Kim
2012-05-11  6:43   ` [tip:perf/core] " 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=20120507172946.GC2485@infradead.org \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.