linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <daahern@cisco.com>
To: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
	acme@ghostprotocols.net
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	David Ahern <daahern@cisco.com>
Subject: [PATCH] perf stat: fix scale option
Date: Sun,  9 Jan 2011 10:50:25 -0700	[thread overview]
Message-ID: <1294595425-16791-1-git-send-email-daahern@cisco.com> (raw)

The scale option defaults to true and the command line option only
allows it to be set to true. ie. the option is a no-op.

Changes the scale option to no_scale to maintain current default
of scaling enabled; no_scale set to true then disables scaling.

Signed-off-by: David Ahern <daahern@cisco.com>
---
 tools/perf/builtin-stat.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 02b2d80..42dfeec 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -77,7 +77,7 @@ static int			run_idx				=  0;
 
 static int			run_count			=  1;
 static bool			no_inherit			= false;
-static bool			scale				=  true;
+static bool			no_scale			= false;
 static bool			no_aggr				= false;
 static pid_t			target_pid			= -1;
 static pid_t			target_tid			= -1;
@@ -161,7 +161,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 {
 	struct perf_event_attr *attr = &evsel->attr;
 
-	if (scale)
+	if (!no_scale)
 		attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
@@ -199,7 +199,7 @@ static int read_counter_aggr(struct perf_evsel *counter)
 	u64 *count = counter->counts->aggr.values;
 	int i;
 
-	if (__perf_evsel__read(counter, cpus->nr, threads->nr, scale) < 0)
+	if (__perf_evsel__read(counter, cpus->nr, threads->nr, !no_scale) < 0)
 		return -1;
 
 	for (i = 0; i < 3; i++)
@@ -233,7 +233,7 @@ static int read_counter(struct perf_evsel *counter)
 	int cpu;
 
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
-		if (__perf_evsel__read_on_cpu(counter, cpu, 0, scale) < 0)
+		if (__perf_evsel__read_on_cpu(counter, cpu, 0, !no_scale) < 0)
 			return -1;
 
 		count = counter->counts->cpu[cpu].values;
@@ -619,8 +619,8 @@ static const struct option options[] = {
 		    "stat events on existing thread id"),
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
 		    "system-wide collection from all CPUs"),
-	OPT_BOOLEAN('c', "scale", &scale,
-		    "scale/normalize counters"),
+	OPT_BOOLEAN('c', "no-scale", &no_scale,
+		    "disable scaling / normalization of counters"),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
 	OPT_INTEGER('r', "repeat", &run_count,
-- 
1.7.3.4

             reply	other threads:[~2011-01-09 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-09 17:50 David Ahern [this message]
2011-01-09 19:49 ` [PATCH] perf stat: fix scale option Ingo Molnar
2011-01-09 20:21   ` David Ahern
2011-01-09 20:54     ` 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=1294595425-16791-1-git-send-email-daahern@cisco.com \
    --to=daahern@cisco.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).