Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583940

Re: [PATCHv2 4/5] perf stat: Add -a as a default target

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCHv2 4/5] perf stat: Add -a as a default target
Date 2017-02-18 19:00 +0100
Message-ID <tchsB-4QM-5@gated-at.bofh.it> (permalink)
References (2 earlier) <tbRHR-5pX-39@gated-at.bofh.it> <tbRRw-5tj-15@gated-at.bofh.it> <tbS1b-5xl-17@gated-at.bofh.it> <tbUcF-76j-1@gated-at.bofh.it> <tbVip-7J5-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Feb 17, 2017 at 06:48:13PM +0100, Boris Petkov wrote:
> LGTM.
> 
> Acked-by: me

Well, it looks good but actually trying it is a different story. For
example:

$ ./perf stat -e amd_nb/event=0xe0,umask=0x1f/ sleep 1

still says <not supported> because argc is not 0.

So how about the below diff instead?

$ ./perf stat -e amd_nb/event=0xe0,umask=0x1f/

without args dumps the usage message and

$ ./perf stat -e amd_nb/event=0xe0,umask=0x1f/ sleep 1

actually does the system-wide thing:

 Performance counter stats for 'system wide':

           196,469      amd_nb/event=0xe0,umask=0x1f/

       1.001815180 seconds time elapsed

Hmmm?

 tools/perf/Documentation/perf-stat.txt | 2 +-
 tools/perf/builtin-stat.c              | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Index: linux/tools/perf/Documentation/perf-stat.txt
===================================================================
--- linux.orig/tools/perf/Documentation/perf-stat.txt	2017-02-18 18:38:23.751960730 +0100
+++ linux/tools/perf/Documentation/perf-stat.txt	2017-02-18 18:38:23.743960730 +0100
@@ -63,7 +63,7 @@ report::
 
 -a::
 --all-cpus::
-        system-wide collection from all CPUs
+        system-wide collection from all CPUs (default if no target is specified)
 
 -c::
 --scale::
Index: linux/tools/perf/builtin-stat.c
===================================================================
--- linux.orig/tools/perf/builtin-stat.c	2017-02-18 18:38:23.751960730 +0100
+++ linux/tools/perf/builtin-stat.c	2017-02-18 18:48:33.531959828 +0100
@@ -2445,8 +2445,12 @@ int cmd_stat(int argc, const char **argv
 	} else if (big_num_opt == 0) /* User passed --no-big-num */
 		big_num = false;
 
-	if (!argc && target__none(&target))
-		usage_with_options(stat_usage, stat_options);
+	/* Make system wide (-a) the default target. */
+	if (target__none(&target)) {
+		if (!argc)
+			usage_with_options(stat_usage, stat_options);
+		target.system_wide = true;
+	}
 
 	if (run_count < 0) {
 		pr_err("Run count must be a positive number\n");


-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] perf tools: Few fixes Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
  [PATCH 3/5] perf tools: Fail on using multiple bits long terms without value Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
    [tip:perf/urgent] perf tools: Fail on using multiple bits long  terms without value tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 5/5] perf record: Add -a as a default target Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
    Re: [PATCH 5/5] perf record: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:30 +0100
      Re: [PATCH 5/5] perf record: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 18:10 +0100
        [tip:perf/urgent] perf record: Add -a as default target tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
    Re: [PATCH 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:30 +0100
      Re: [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 15:40 +0100
        Re: [PATCH 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:50 +0100
          Re: [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 15:50 +0100
          [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 18:10 +0100
            Re: [PATCHv2 4/5] perf stat: Add -a as a default target Boris Petkov <bp@alien8.de> - 2017-02-17 19:20 +0100
              Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-18 19:00 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-20 08:20 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-20 21:40 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-20 22:30 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-20 23:50 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-21 09:00 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-21 12:10 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-21 12:30 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-21 14:40 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-21 15:10 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-21 15:30 +0100
            [tip:perf/urgent] perf stat: Add -a as default target tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 1/5] perf build: Add special fixdep cleaning rule Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
    [tip:perf/urgent] perf build: Add special fixdep cleaning rule tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100

csiph-web