On 9/30/13 2:47 AM, Namhyung Kim wrote:
@@ -1517,8 +1517,10 @@ int cmd_stat(int argc, const char **argv, const char 
*prefix __maybe_unused)
        } else if (big_num_opt == 0) /* User passed --no-big-num */
                big_num = false;

-       if (!argc && !perf_target__has_task(&target))
+       if (!argc && !perf_target__has_task(&target) &&
+           !perf_target__has_cpu(&target))

You can use perf_target__none() for this.

Indeed. Updated patch attached.

David

>From a7018902283b3cfc5cae8a1876e2c14f3c7c9c7e Mon Sep 17 00:00:00 2001
From: David Ahern <dsah...@gmail.com>
Date: Mon, 30 Sep 2013 07:37:37 -0600
Subject: [PATCH] perf stat: Don't require a workload when using system wide or 
CPU options -v2

perf-stat can do system wide counters or one or more cpus. For
these options do not require a workload to be specified.

v2: use perf_target__none per Namhyung's comment

Signed-off-by: David Ahern <dsah...@gmail.com>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Namhyung Kim <namhyung....@lge.com>
Cc: Stephane Eranian <eran...@google.com>
---
 tools/perf/builtin-stat.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6cc0aa2..db55b91 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1517,8 +1517,9 @@ int cmd_stat(int argc, const char **argv, const char 
*prefix __maybe_unused)
        } else if (big_num_opt == 0) /* User passed --no-big-num */
                big_num = false;
 
-       if (!argc && !perf_target__has_task(&target))
+       if (!argc && perf_target__none(&target))
                usage_with_options(stat_usage, options);
+
        if (run_count < 0) {
                usage_with_options(stat_usage, options);
        } else if (run_count == 0) {
-- 
1.7.10.1

Reply via email to