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.

Reply via email to