perf stat: Move the shadow stats scale computation in perf_stat__update_shadow_stats
tip-bot for Jiri Olsa
merge botCommit-ID: 54830dd0c342525de2ff10f8be7cf0a9f062b896 Gitweb: https://git.kernel.org/tip/54830dd0c342525de2ff10f8be7cf0a9f062b896 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 23 Jan 2017 22:42:56 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 30 Oct 2017 13:40:33 -0300
perf stat: Move the shadow stats scale computation in perf_stat__update_shadow_stats
Move the shadow stats scale computation to the perf_stat__update_shadow_stats() function, so it's centralized and we don't forget to do it. It also saves few lines of code.
Signed-off-by Jiri Olsa <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Changbin Du <[email protected]>
Cc David Ahern <[email protected]>
Cc Jin Yao <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-stat.c | 3 +-- tools/perf/util/stat-shadow.c | 48 ++++++++++++++++++++++--------------------- tools/perf/util/stat.c | 6 ++---- tools/perf/util/stat.h | 2 +- 4 files changed, 29 insertions(+), 30 deletions(-)
tools/perf/builtin-stat.c +1 -2
@@ -1267,8 +1267,7 @@ static void aggr_update_shadow(void)continue ; val +=perf_counts (counter->counts, cpu,0 )->val; } - val = val * counter->scale; -perf_stat__update_shadow_stats (counter, &val, +perf_stat__update_shadow_stats (counter, val,first_shadow_cpu (counter, id)); } }
tools/perf/util/stat-shadow.c +25 -23
83 lines not on this page · raw message
tools/perf/util/stat.c +2 -4
@@ -277,7 +277,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evselperf_evsel__compute_deltas (evsel, cpu, thread, count);perf_counts_values__scale (count, config->scale,NULL );if (config->aggr_mode ==AGGR_NONE ) -perf_stat__update_shadow_stats (evsel, count->values, cpu); +perf_stat__update_shadow_stats (evsel, count->val, cpu);break ;case AGGR_GLOBAL : aggr->val += count->val;
@@ -320,7 +320,6 @@ int perf_stat_process_counter(struct perf_stat_config *config,struct perf_counts_values *aggr = &counter->counts->aggr;struct perf_stat_evsel *ps = counter->stats;u64 *count = counter->counts->aggr.values; -u64 val;int i, ret; aggr->val = aggr->ena = aggr->run =0 ;
@@ -360,8 +359,7 @@ int perf_stat_process_counter(struct perf_stat_config *config,/* * Save the full runtime - to allow normalization during printout: */ - val = counter->scale * *count; -perf_stat__update_shadow_stats (counter, &val,0 ); +perf_stat__update_shadow_stats (counter, *count,0 );return 0 ; }
tools/perf/util/stat.h +1 -1
@@ -82,7 +82,7 @@ typedef void (*new_line_t )(void *ctx);void perf_stat__init_shadow_stats (void );void perf_stat__reset_shadow_stats (void ); -void perf_stat__update_shadow_stats (struct perf_evsel *counter,u64 *count, +void perf_stat__update_shadow_stats (struct perf_evsel *counter,u64 count,int cpu);struct perf_stat_output_ctx {void *ctx;