Skip to content

Commit

Permalink
perf stat: Move perf_stat initialization counter process code
Browse files Browse the repository at this point in the history
Moving perf_stat initialization counter process code,
to make the reading path free of processing logic.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
olsajiri authored and acmel committed Jun 26, 2015
1 parent 32ce0a4 commit 7ddb1b6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ static int process_counter(struct perf_evsel *counter)
int i, ret;

aggr->val = aggr->ena = aggr->run = 0;
memset(ps->res_stats, 0, sizeof(ps->res_stats));

if (counter->per_pkg)
zero_per_pkg(counter);
Expand Down Expand Up @@ -347,12 +348,8 @@ static int read_counter(struct perf_evsel *counter)
static void read_counters(bool close)
{
struct perf_evsel *counter;
struct perf_stat *ps;

evlist__for_each(evsel_list, counter) {
ps = counter->priv;
memset(ps->res_stats, 0, sizeof(ps->res_stats));

if (read_counter(counter))
pr_warning("failed to read counter %s\n", counter->name);

Expand Down

0 comments on commit 7ddb1b6

Please sign in to comment.