Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf stat: Move 'interval' into struct perf_stat_config

Moving 'interval' into struct perf_stat_config. The point is to
centralize the base stat config so it could be used localy together with
other stat routines in other parts of perf code.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1437481927-29538-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
ec0d3d1f 5821522e

+10 -5
+9 -5
tools/perf/builtin-stat.c
··· 113 113 static const char *pre_cmd = NULL; 114 114 static const char *post_cmd = NULL; 115 115 static bool sync_run = false; 116 - static unsigned int interval = 0; 117 116 static unsigned int initial_delay = 0; 118 117 static unsigned int unit_width = 4; /* strlen("unit") */ 119 118 static bool forever = false; ··· 403 404 404 405 static int __run_perf_stat(int argc, const char **argv) 405 406 { 407 + int interval = stat_config.interval; 406 408 char msg[512]; 407 409 unsigned long long t0, t1; 408 410 struct perf_evsel *counter; ··· 646 646 if (evsel->cgrp) 647 647 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); 648 648 649 - if (csv_output || interval) 649 + if (csv_output || stat_config.interval) 650 650 return; 651 651 652 652 if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK)) ··· 689 689 if (evsel->cgrp) 690 690 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); 691 691 692 - if (csv_output || interval) 692 + if (csv_output || stat_config.interval) 693 693 return; 694 694 695 695 perf_stat__print_shadow_stats(output, evsel, avg, cpu, ··· 990 990 991 991 static void print_counters(struct timespec *ts, int argc, const char **argv) 992 992 { 993 + int interval = stat_config.interval; 993 994 struct perf_evsel *counter; 994 995 char buf[64], *prefix = NULL; 995 996 ··· 1030 1029 1031 1030 static void skip_signal(int signo) 1032 1031 { 1033 - if ((child_pid == -1) || interval) 1032 + if ((child_pid == -1) || stat_config.interval) 1034 1033 done = 1; 1035 1034 1036 1035 signr = signo; ··· 1314 1313 "command to run prior to the measured command"), 1315 1314 OPT_STRING(0, "post", &post_cmd, "command", 1316 1315 "command to run after to the measured command"), 1317 - OPT_UINTEGER('I', "interval-print", &interval, 1316 + OPT_UINTEGER('I', "interval-print", &stat_config.interval, 1318 1317 "print counts at regular interval in ms (>= 100)"), 1319 1318 OPT_SET_UINT(0, "per-socket", &stat_config.aggr_mode, 1320 1319 "aggregate counts per processor socket", AGGR_SOCKET), ··· 1333 1332 int status = -EINVAL, run_idx; 1334 1333 const char *mode; 1335 1334 FILE *output = stderr; 1335 + unsigned int interval; 1336 1336 1337 1337 setlocale(LC_ALL, ""); 1338 1338 ··· 1343 1341 1344 1342 argc = parse_options(argc, argv, options, stat_usage, 1345 1343 PARSE_OPT_STOP_AT_NON_OPTION); 1344 + 1345 + interval = stat_config.interval; 1346 1346 1347 1347 if (output_name && strcmp(output_name, "-")) 1348 1348 output = NULL;
+1
tools/perf/util/stat.h
··· 54 54 enum aggr_mode aggr_mode; 55 55 bool scale; 56 56 FILE *output; 57 + unsigned int interval; 57 58 }; 58 59 59 60 static inline struct perf_counts_values*