diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-08-30 08:32:44 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-08-30 15:52:24 -0300 |
commit | 8897a8916efb29fa8bbe9e5f6e5d56362aedf64e (patch) | |
tree | d2de6ac06c7525678d0a42f9f7f9d647d77922ca /tools/perf/builtin-stat.c | |
parent | 3b3cd9a41c2b5d97309099ba6eae69b2d3177226 (diff) | |
download | linux-8897a8916efb29fa8bbe9e5f6e5d56362aedf64e.tar.bz2 |
perf stat: Move ru_* data to 'struct perf_stat_config'
Move the 'ru_*' global variables to 'struct perf_stat_config', so that
it can be passed around and used outside the 'perf stat' command.
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-36-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.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f61c2dc8c7e8..942ebfd8ef2e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -171,8 +171,6 @@ static bool interval_count; static const char *output_name; static int output_fd; static u64 *walltime_run; -static bool ru_display = false; -static struct rusage ru_data; struct perf_stat { bool record; @@ -583,7 +581,7 @@ try_again: break; } } - wait4(child_pid, &status, 0, &ru_data); + wait4(child_pid, &status, 0, &stat_config.ru_data); if (workload_exec_errno) { const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg)); @@ -1679,9 +1677,9 @@ static void print_footer(struct perf_stat_config *config) if (config->run_count == 1) { fprintf(output, " %17.9f seconds time elapsed", avg); - if (ru_display) { - double ru_utime = timeval2double(&ru_data.ru_utime); - double ru_stime = timeval2double(&ru_data.ru_stime); + if (config->ru_display) { + double ru_utime = timeval2double(&config->ru_data.ru_utime); + double ru_stime = timeval2double(&config->ru_data.ru_stime); fprintf(output, "\n\n"); fprintf(output, " %17.9f seconds user\n", ru_utime); @@ -2855,7 +2853,7 @@ int cmd_stat(int argc, const char **argv) * run and when there's specified tracee. */ if ((stat_config.run_count == 1) && target__none(&target)) - ru_display = true; + stat_config.ru_display = true; if (stat_config.run_count < 0) { pr_err("Run count must be a positive number\n"); |