summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-30 08:32:40 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-30 15:52:24 -0300
commit26893a6018f88779c0aded934e99e0ebb6859a58 (patch)
tree492e3d1e5450446a631b206e9964af973517e33d /tools/perf/builtin-stat.c
parent77e0faf8552c9329d58a4de460928e03252647c6 (diff)
perf stat: Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config'
Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config', so that it can be passed around and used outside the 'perf stat' command. It's initialized to point to stat's walltime_nsecs_stats value. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180830063252.23729-32-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2711d8f6e4b8..381549a989b4 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -195,11 +195,12 @@ static struct perf_stat perf_stat;
static volatile int done = 0;
static struct perf_stat_config stat_config = {
- .aggr_mode = AGGR_GLOBAL,
- .scale = true,
- .unit_width = 4, /* strlen("unit") */
- .run_count = 1,
- .metric_only_len = METRIC_ONLY_LEN,
+ .aggr_mode = AGGR_GLOBAL,
+ .scale = true,
+ .unit_width = 4, /* strlen("unit") */
+ .run_count = 1,
+ .metric_only_len = METRIC_ONLY_LEN,
+ .walltime_nsecs_stats = &walltime_nsecs_stats,
};
static bool is_duration_time(struct perf_evsel *evsel)
@@ -1671,7 +1672,7 @@ static double timeval2double(struct timeval *t)
static void print_footer(struct perf_stat_config *config)
{
- double avg = avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
+ double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC;
FILE *output = config->output;
int n;
@@ -1690,7 +1691,7 @@ static void print_footer(struct perf_stat_config *config)
fprintf(output, " %17.9f seconds sys\n", ru_stime);
}
} else {
- double sd = stddev_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
+ double sd = stddev_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC;
/*
* Display at most 2 more significant
* digits than the stddev inaccuracy.