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

perf stat: Kill unused per-thread runtime stats

Now it's using the global rt_stat, no need to use per-thread stats. Let
get rid of them.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20220930202110.845199-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
f407aac4 87ae87fd

-56
-54
tools/perf/builtin-stat.c
··· 292 292 293 293 static void perf_stat__reset_stats(void) 294 294 { 295 - int i; 296 - 297 295 evlist__reset_stats(evsel_list); 298 296 perf_stat__reset_shadow_stats(); 299 - 300 - for (i = 0; i < stat_config.stats_num; i++) 301 - perf_stat__reset_shadow_per_stat(&stat_config.stats[i]); 302 297 } 303 298 304 299 static int process_synthesized_event(struct perf_tool *tool __maybe_unused, ··· 484 489 } 485 490 } 486 491 487 - static int runtime_stat_new(struct perf_stat_config *config, int nthreads) 488 - { 489 - int i; 490 - 491 - config->stats = calloc(nthreads, sizeof(struct runtime_stat)); 492 - if (!config->stats) 493 - return -1; 494 - 495 - config->stats_num = nthreads; 496 - 497 - for (i = 0; i < nthreads; i++) 498 - runtime_stat__init(&config->stats[i]); 499 - 500 - return 0; 501 - } 502 - 503 - static void runtime_stat_delete(struct perf_stat_config *config) 504 - { 505 - int i; 506 - 507 - if (!config->stats) 508 - return; 509 - 510 - for (i = 0; i < config->stats_num; i++) 511 - runtime_stat__exit(&config->stats[i]); 512 - 513 - zfree(&config->stats); 514 - } 515 - 516 - static void runtime_stat_reset(struct perf_stat_config *config) 517 - { 518 - int i; 519 - 520 - if (!config->stats) 521 - return; 522 - 523 - for (i = 0; i < config->stats_num; i++) 524 - perf_stat__reset_shadow_per_stat(&config->stats[i]); 525 - } 526 - 527 492 static void process_interval(void) 528 493 { 529 494 struct timespec ts, rs; ··· 492 537 diff_timespec(&rs, &ts, &ref_time); 493 538 494 539 perf_stat__reset_shadow_per_stat(&rt_stat); 495 - runtime_stat_reset(&stat_config); 496 540 read_counters(&rs); 497 541 498 542 if (STAT_RECORD) { ··· 968 1014 969 1015 evlist__copy_prev_raw_counts(evsel_list); 970 1016 evlist__reset_prev_raw_counts(evsel_list); 971 - runtime_stat_reset(&stat_config); 972 1017 perf_stat__reset_shadow_per_stat(&rt_stat); 973 1018 } else { 974 1019 update_stats(&walltime_nsecs_stats, t1 - t0); ··· 2463 2510 */ 2464 2511 if (stat_config.aggr_mode == AGGR_THREAD) { 2465 2512 thread_map__read_comms(evsel_list->core.threads); 2466 - if (target.system_wide) { 2467 - if (runtime_stat_new(&stat_config, 2468 - perf_thread_map__nr(evsel_list->core.threads))) { 2469 - goto out; 2470 - } 2471 - } 2472 2513 } 2473 2514 2474 2515 if (stat_config.aggr_mode == AGGR_NODE) ··· 2603 2656 evlist__delete(evsel_list); 2604 2657 2605 2658 metricgroup__rblist_exit(&stat_config.metric_events); 2606 - runtime_stat_delete(&stat_config); 2607 2659 evlist__close_control(stat_config.ctl_fd, stat_config.ctl_fd_ack, &stat_config.ctl_fd_close); 2608 2660 2609 2661 return status;
-2
tools/perf/util/stat.h
··· 153 153 int run_count; 154 154 int print_free_counters_hint; 155 155 int print_mixed_hw_group_error; 156 - struct runtime_stat *stats; 157 - int stats_num; 158 156 const char *csv_sep; 159 157 struct stats *walltime_nsecs_stats; 160 158 struct rusage ru_data;