[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1294595425-16791-1-git-send-email-daahern@cisco.com>
Date: Sun, 9 Jan 2011 10:50:25 -0700
From: David Ahern <daahern@...co.com>
To: a.p.zijlstra@...llo.nl, paulus@...ba.org, mingo@...e.hu,
acme@...stprotocols.net
Cc: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
David Ahern <daahern@...co.com>
Subject: [PATCH] perf stat: fix scale option
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@...co.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists