* [PATCH] perf, tools, stat: Fix perf stat -T
@ 2015-07-27 23:24 Andi Kleen
2015-07-28 14:10 ` Jiri Olsa
2015-07-31 13:48 ` [tip:perf/core] perf stat: Fix transaction lenght metrics tip-bot for Andi Kleen
0 siblings, 2 replies; 8+ messages in thread
From: Andi Kleen @ 2015-07-27 23:24 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, Andi Kleen, jolsa
From: Andi Kleen <ak@linux.intel.com>
The transaction length metrics in perf stat -T broke recently.
It would not match the metric correctly and always print K/sec.
This was caused by a incorrect update of the cycles_in_tx statistics.
Update the correct variable.
Also the check for zero division was reversed, which resulted
in K/sec being printed for no transactions. Fix this also up.
Cc: jolsa@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/stat-shadow.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 53e8bb7..2a5d8d7 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
- update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
+ update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, TRANSACTION_START))
update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, ELISION_START))
@@ -398,20 +398,18 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
" # %5.2f%% aborted cycles ",
100.0 * ((total2-avg) / total));
} else if (perf_stat_evsel__is(evsel, TRANSACTION_START) &&
- avg > 0 &&
runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
- if (total)
+ if (avg)
ratio = total / avg;
fprintf(out, " # %8.0f cycles / transaction ", ratio);
} else if (perf_stat_evsel__is(evsel, ELISION_START) &&
- avg > 0 &&
runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
- if (total)
+ if (avg)
ratio = total / avg;
fprintf(out, " # %8.0f cycles / elision ", ratio);
--
2.4.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-27 23:24 [PATCH] perf, tools, stat: Fix perf stat -T Andi Kleen
@ 2015-07-28 14:10 ` Jiri Olsa
2015-07-28 14:21 ` Arnaldo Carvalho de Melo
2015-07-31 13:48 ` [tip:perf/core] perf stat: Fix transaction lenght metrics tip-bot for Andi Kleen
1 sibling, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2015-07-28 14:10 UTC (permalink / raw)
To: Andi Kleen; +Cc: acme, linux-kernel, Andi Kleen, jolsa
On Mon, Jul 27, 2015 at 04:24:51PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> The transaction length metrics in perf stat -T broke recently.
> It would not match the metric correctly and always print K/sec.
> This was caused by a incorrect update of the cycles_in_tx statistics.
> Update the correct variable.
>
> Also the check for zero division was reversed, which resulted
> in K/sec being printed for no transactions. Fix this also up.
>
> Cc: jolsa@kernel.org
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> tools/perf/util/stat-shadow.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index 53e8bb7..2a5d8d7 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
> else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
> update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
> else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
> - update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
> + update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
oops, looks like copy&paste issue.. thanks
> else if (perf_stat_evsel__is(counter, TRANSACTION_START))
> update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
> else if (perf_stat_evsel__is(counter, ELISION_START))
> @@ -398,20 +398,18 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
> " # %5.2f%% aborted cycles ",
> 100.0 * ((total2-avg) / total));
> } else if (perf_stat_evsel__is(evsel, TRANSACTION_START) &&
> - avg > 0 &&
> runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
> total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
>
> - if (total)
> + if (avg)
> ratio = total / avg;
>
> fprintf(out, " # %8.0f cycles / transaction ", ratio);
> } else if (perf_stat_evsel__is(evsel, ELISION_START) &&
> - avg > 0 &&
> runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
> total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
>
> - if (total)
> + if (avg)
> ratio = total / avg;
>
> fprintf(out, " # %8.0f cycles / elision ", ratio);
> --
we now print comment line if the avg is 0, but I think it's ok
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-28 14:10 ` Jiri Olsa
@ 2015-07-28 14:21 ` Arnaldo Carvalho de Melo
2015-07-28 14:30 ` Jiri Olsa
0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-28 14:21 UTC (permalink / raw)
To: Jiri Olsa; +Cc: Andi Kleen, linux-kernel, Andi Kleen, jolsa
Em Tue, Jul 28, 2015 at 04:10:06PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 27, 2015 at 04:24:51PM -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> >
> > The transaction length metrics in perf stat -T broke recently.
> > It would not match the metric correctly and always print K/sec.
> > This was caused by a incorrect update of the cycles_in_tx statistics.
> > Update the correct variable.
> >
> > Also the check for zero division was reversed, which resulted
> > in K/sec being printed for no transactions. Fix this also up.
> >
> > Cc: jolsa@kernel.org
> > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> > ---
> > tools/perf/util/stat-shadow.c | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> > index 53e8bb7..2a5d8d7 100644
> > --- a/tools/perf/util/stat-shadow.c
> > +++ b/tools/perf/util/stat-shadow.c
> > @@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
> > else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
> > update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
> > else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
> > - update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
> > + update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
>
> oops, looks like copy&paste issue.. thanks
>
>
> we now print comment line if the avg is 0, but I think it's ok
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
This affects just perf/core, right?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-28 14:21 ` Arnaldo Carvalho de Melo
@ 2015-07-28 14:30 ` Jiri Olsa
2015-07-28 14:32 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2015-07-28 14:30 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Andi Kleen, linux-kernel, Andi Kleen, jolsa
On Tue, Jul 28, 2015 at 11:21:32AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jul 28, 2015 at 04:10:06PM +0200, Jiri Olsa escreveu:
> > On Mon, Jul 27, 2015 at 04:24:51PM -0700, Andi Kleen wrote:
> > > From: Andi Kleen <ak@linux.intel.com>
> > >
> > > The transaction length metrics in perf stat -T broke recently.
> > > It would not match the metric correctly and always print K/sec.
> > > This was caused by a incorrect update of the cycles_in_tx statistics.
> > > Update the correct variable.
> > >
> > > Also the check for zero division was reversed, which resulted
> > > in K/sec being printed for no transactions. Fix this also up.
> > >
> > > Cc: jolsa@kernel.org
> > > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> > > ---
> > > tools/perf/util/stat-shadow.c | 8 +++-----
> > > 1 file changed, 3 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> > > index 53e8bb7..2a5d8d7 100644
> > > --- a/tools/perf/util/stat-shadow.c
> > > +++ b/tools/perf/util/stat-shadow.c
> > > @@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
> > > else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
> > > update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
> > > else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
> > > - update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
> > > + update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
> >
> > oops, looks like copy&paste issue.. thanks
> >
> >
> > we now print comment line if the avg is 0, but I think it's ok
> >
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> This affects just perf/core, right?
I guess, dont think it's an urgent one.. Andi, please speak up ;-)
jirka
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-28 14:30 ` Jiri Olsa
@ 2015-07-28 14:32 ` Arnaldo Carvalho de Melo
2015-07-28 14:37 ` Jiri Olsa
0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-28 14:32 UTC (permalink / raw)
To: Jiri Olsa; +Cc: Andi Kleen, linux-kernel, Andi Kleen, jolsa
Em Tue, Jul 28, 2015 at 04:30:18PM +0200, Jiri Olsa escreveu:
> On Tue, Jul 28, 2015 at 11:21:32AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Jul 28, 2015 at 04:10:06PM +0200, Jiri Olsa escreveu:
> > > On Mon, Jul 27, 2015 at 04:24:51PM -0700, Andi Kleen wrote:
> > > > +++ b/tools/perf/util/stat-shadow.c
> > > > + update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
> > > oops, looks like copy&paste issue.. thanks
> > > we now print comment line if the avg is 0, but I think it's ok
> > > Acked-by: Jiri Olsa <jolsa@kernel.org>
> > This affects just perf/core, right?
> I guess, dont think it's an urgent one.. Andi, please speak up ;-)
I'm not talking about it being urgent or not, I'm talking about it being
a bug present only in perf/core or if this is something that is in
perf/urgent, i.e. affects what is in Linus's upstream tree, etc.
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-28 14:32 ` Arnaldo Carvalho de Melo
@ 2015-07-28 14:37 ` Jiri Olsa
2015-07-28 17:25 ` Andi Kleen
0 siblings, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2015-07-28 14:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Andi Kleen, linux-kernel, Andi Kleen, jolsa
On Tue, Jul 28, 2015 at 11:32:57AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jul 28, 2015 at 04:30:18PM +0200, Jiri Olsa escreveu:
> > On Tue, Jul 28, 2015 at 11:21:32AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Jul 28, 2015 at 04:10:06PM +0200, Jiri Olsa escreveu:
> > > > On Mon, Jul 27, 2015 at 04:24:51PM -0700, Andi Kleen wrote:
> > > > > +++ b/tools/perf/util/stat-shadow.c
> > > > > + update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
>
> > > > oops, looks like copy&paste issue.. thanks
>
> > > > we now print comment line if the avg is 0, but I think it's ok
>
> > > > Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> > > This affects just perf/core, right?
>
> > I guess, dont think it's an urgent one.. Andi, please speak up ;-)
>
> I'm not talking about it being urgent or not, I'm talking about it being
> a bug present only in perf/core or if this is something that is in
> perf/urgent, i.e. affects what is in Linus's upstream tree, etc.
ah ok, it affects perf/urgent as well
jirka
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf, tools, stat: Fix perf stat -T
2015-07-28 14:37 ` Jiri Olsa
@ 2015-07-28 17:25 ` Andi Kleen
0 siblings, 0 replies; 8+ messages in thread
From: Andi Kleen @ 2015-07-28 17:25 UTC (permalink / raw)
To: Jiri Olsa; +Cc: Arnaldo Carvalho de Melo, Andi Kleen, linux-kernel, jolsa
> > I'm not talking about it being urgent or not, I'm talking about it being
> > a bug present only in perf/core or if this is something that is in
> > perf/urgent, i.e. affects what is in Linus's upstream tree, etc.
>
> ah ok, it affects perf/urgent as well
I think there are some more typos in the cache statistics.
Compare perf stat -d -d -d -d output with an old perf.
-Andi
--
ak@linux.intel.com -- Speaking for myself only
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf stat: Fix transaction lenght metrics
2015-07-27 23:24 [PATCH] perf, tools, stat: Fix perf stat -T Andi Kleen
2015-07-28 14:10 ` Jiri Olsa
@ 2015-07-31 13:48 ` tip-bot for Andi Kleen
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Andi Kleen @ 2015-07-31 13:48 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, mingo, jolsa, ak, hpa, tglx, acme
Commit-ID: 5497628576a3c5f3dbab224fa5a5d027f43d8b50
Gitweb: http://git.kernel.org/tip/5497628576a3c5f3dbab224fa5a5d027f43d8b50
Author: Andi Kleen <ak@linux.intel.com>
AuthorDate: Mon, 27 Jul 2015 16:24:51 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 Jul 2015 12:05:04 -0300
perf stat: Fix transaction lenght metrics
The transaction length metrics in perf stat -T broke recently.
It would not match the metric correctly and always print K/sec.
This was caused by a incorrect update of the cycles_in_tx statistics.
Update the correct variable.
Also the check for zero division was reversed, which resulted in K/sec
being printed for no transactions. Fix this also up.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1438039491-22091-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/stat-shadow.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 53e8bb7..2a5d8d7 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
- update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
+ update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, TRANSACTION_START))
update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
else if (perf_stat_evsel__is(counter, ELISION_START))
@@ -398,20 +398,18 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
" # %5.2f%% aborted cycles ",
100.0 * ((total2-avg) / total));
} else if (perf_stat_evsel__is(evsel, TRANSACTION_START) &&
- avg > 0 &&
runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
- if (total)
+ if (avg)
ratio = total / avg;
fprintf(out, " # %8.0f cycles / transaction ", ratio);
} else if (perf_stat_evsel__is(evsel, ELISION_START) &&
- avg > 0 &&
runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
- if (total)
+ if (avg)
ratio = total / avg;
fprintf(out, " # %8.0f cycles / elision ", ratio);
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-31 13:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 23:24 [PATCH] perf, tools, stat: Fix perf stat -T Andi Kleen
2015-07-28 14:10 ` Jiri Olsa
2015-07-28 14:21 ` Arnaldo Carvalho de Melo
2015-07-28 14:30 ` Jiri Olsa
2015-07-28 14:32 ` Arnaldo Carvalho de Melo
2015-07-28 14:37 ` Jiri Olsa
2015-07-28 17:25 ` Andi Kleen
2015-07-31 13:48 ` [tip:perf/core] perf stat: Fix transaction lenght metrics tip-bot for Andi Kleen
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).