* [PATCH] perf stat: fix scale option
@ 2011-01-09 17:50 David Ahern
2011-01-09 19:49 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2011-01-09 17:50 UTC (permalink / raw)
To: a.p.zijlstra, paulus, mingo, acme
Cc: linux-kernel, linux-perf-users, David Ahern
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf stat: fix scale option
2011-01-09 17:50 [PATCH] perf stat: fix scale option David Ahern
@ 2011-01-09 19:49 ` Ingo Molnar
2011-01-09 20:21 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2011-01-09 19:49 UTC (permalink / raw)
To: David Ahern; +Cc: a.p.zijlstra, paulus, acme, linux-kernel, linux-perf-users
* David Ahern <daahern@cisco.com> wrote:
> 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.
Hm, the option parser should already allow --no-scale. Does that not work for you?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf stat: fix scale option
2011-01-09 19:49 ` Ingo Molnar
@ 2011-01-09 20:21 ` David Ahern
2011-01-09 20:54 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2011-01-09 20:21 UTC (permalink / raw)
To: Ingo Molnar; +Cc: a.p.zijlstra, paulus, acme, linux-kernel, linux-perf-users
On 01/09/11 12:49, Ingo Molnar wrote:
>
> * David Ahern <daahern@cisco.com> wrote:
>
>> 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.
>
> Hm, the option parser should already allow --no-scale. Does that not work for you?
>
> Thanks,
>
> Ingo
Indeed it does work; I was not aware of that option. What about the '-c'
option being a no-op?
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf stat: fix scale option
2011-01-09 20:21 ` David Ahern
@ 2011-01-09 20:54 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2011-01-09 20:54 UTC (permalink / raw)
To: David Ahern; +Cc: a.p.zijlstra, paulus, acme, linux-kernel, linux-perf-users
* David Ahern <daahern@cisco.com> wrote:
> On 01/09/11 12:49, Ingo Molnar wrote:
> >
> > * David Ahern <daahern@cisco.com> wrote:
> >
> >> 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.
> >
> > Hm, the option parser should already allow --no-scale. Does that not work for you?
> >
> > Thanks,
> >
> > Ingo
>
> Indeed it does work; I was not aware of that option. What about the '-c'
> option being a no-op?
Yeah, that's indeed inconsistent and we could flip the option around i suspect.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-09 20:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-09 17:50 [PATCH] perf stat: fix scale option David Ahern
2011-01-09 19:49 ` Ingo Molnar
2011-01-09 20:21 ` David Ahern
2011-01-09 20:54 ` Ingo Molnar
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).