All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 05/11] perf top: Do show usage message when failing to create cpu/thread maps
Date: Thu, 10 Dec 2015 16:43:25 -0300	[thread overview]
Message-ID: <1449776611-18538-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1449776611-18538-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

This is necessary to get rid of the browser dependency from
usage_with_options() and its friends.  Because we validate the targets
which are used to create the cpu/thread maps and inform the user about
any override performed via the chosen UI, we don't need to call the
usage routine for that.

Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-slu7lj7buzpwgop1vo9la8ma@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 7e2e72e6d9d1..84fd6368ed6d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1279,8 +1279,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (target__none(target))
 		target->system_wide = true;
 
-	if (perf_evlist__create_maps(top.evlist, target) < 0)
-		usage_with_options(top_usage, options);
+	if (perf_evlist__create_maps(top.evlist, target) < 0) {
+		ui__error("Couldn't create thread/CPU maps: %s\n",
+			  errno == ENOENT ? "No such process" : strerror_r(errno, errbuf, sizeof(errbuf)));
+		goto out_delete_evlist;
+	}
 
 	if (!top.evlist->nr_entries &&
 	    perf_evlist__add_default(top.evlist) < 0) {
-- 
2.1.0


  parent reply	other threads:[~2015-12-10 19:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 19:43 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 01/11] perf annotate: Check argument before calling setup_browser() Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 02/11] perf annotate: Delay UI browser setup after initialization is done Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 03/11] perf kvm: Remove invocation of setup/exit_browser() Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 04/11] perf report: Check argument before calling setup_browser() Arnaldo Carvalho de Melo
2015-12-10 19:43 ` Arnaldo Carvalho de Melo [this message]
2015-12-10 19:43 ` [PATCH 06/11] perf thread_map: Free strlist on constructor error path Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 07/11] perf tools: Get rid of exit_browser() from usage_with_options() Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 08/11] perf top: Delete half-processed hist entries when exit Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 09/11] Revert "perf tools: Improve setting of gcc debug option" Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 10/11] perf tools: Make perf_session__register_idle_thread drop the refcount Arnaldo Carvalho de Melo
2015-12-10 19:43 ` [PATCH 11/11] perf symbols: Fix dso__load_sym to put dso Arnaldo Carvalho de Melo
2015-12-11  7:48 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar

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=1449776611-18538-6-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 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.