mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 11:06:41 -05:00
perf stat: Reduce scope of walltime_nsecs_stats
walltime_nsecs_stats is no longer used for counter values, move into that stat_config where it controls certain things like noise measurement. Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -239,7 +239,7 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a,
|
||||
static void perf_stat__reset_stats(void)
|
||||
{
|
||||
evlist__reset_stats(evsel_list);
|
||||
perf_stat__reset_shadow_stats();
|
||||
memset(stat_config.walltime_nsecs_stats, 0, sizeof(*stat_config.walltime_nsecs_stats));
|
||||
}
|
||||
|
||||
static int process_synthesized_event(const struct perf_tool *tool __maybe_unused,
|
||||
@@ -455,8 +455,8 @@ static void process_interval(void)
|
||||
pr_err("failed to write stat round event\n");
|
||||
}
|
||||
|
||||
init_stats(&walltime_nsecs_stats);
|
||||
update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000ULL);
|
||||
init_stats(stat_config.walltime_nsecs_stats);
|
||||
update_stats(stat_config.walltime_nsecs_stats, stat_config.interval * 1000000ULL);
|
||||
print_counters(&rs, 0, NULL);
|
||||
}
|
||||
|
||||
@@ -988,14 +988,14 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
|
||||
if (interval && stat_config.summary) {
|
||||
stat_config.interval = 0;
|
||||
stat_config.stop_read_counter = true;
|
||||
init_stats(&walltime_nsecs_stats);
|
||||
update_stats(&walltime_nsecs_stats, t1 - t0);
|
||||
init_stats(stat_config.walltime_nsecs_stats);
|
||||
update_stats(stat_config.walltime_nsecs_stats, t1 - t0);
|
||||
|
||||
evlist__copy_prev_raw_counts(evsel_list);
|
||||
evlist__reset_prev_raw_counts(evsel_list);
|
||||
evlist__reset_aggr_stats(evsel_list);
|
||||
} else {
|
||||
update_stats(&walltime_nsecs_stats, t1 - t0);
|
||||
update_stats(stat_config.walltime_nsecs_stats, t1 - t0);
|
||||
update_rusage_stats(&stat_config.ru_data);
|
||||
}
|
||||
|
||||
@@ -2167,7 +2167,7 @@ static int process_stat_round_event(const struct perf_tool *tool __maybe_unused,
|
||||
process_counters();
|
||||
|
||||
if (stat_round->type == PERF_STAT_ROUND_TYPE__FINAL)
|
||||
update_stats(&walltime_nsecs_stats, stat_round->time);
|
||||
update_stats(stat_config.walltime_nsecs_stats, stat_round->time);
|
||||
|
||||
if (stat_config.interval && stat_round->time) {
|
||||
tsh.tv_sec = stat_round->time / NSEC_PER_SEC;
|
||||
@@ -2975,7 +2975,7 @@ int cmd_stat(int argc, const char **argv)
|
||||
}
|
||||
|
||||
if (!interval) {
|
||||
if (WRITE_STAT_ROUND_EVENT(walltime_nsecs_stats.max, FINAL))
|
||||
if (WRITE_STAT_ROUND_EVENT(stat_config.walltime_nsecs_stats->max, FINAL))
|
||||
pr_err("failed to write stat round event\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ static void load_runtime_stat(struct evlist *evlist, struct value *vals)
|
||||
count = find_value(evsel->name, vals);
|
||||
evsel->supported = true;
|
||||
evsel->stats->aggr->counts.val = count;
|
||||
if (evsel__name_is(evsel, "duration_time"))
|
||||
update_stats(&walltime_nsecs_stats, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -872,8 +872,6 @@ static int test__parsing_callback(const struct pmu_metric *pm,
|
||||
evlist__alloc_aggr_stats(evlist, 1);
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
evsel->stats->aggr->counts.val = k;
|
||||
if (evsel__name_is(evsel, "duration_time"))
|
||||
update_stats(&walltime_nsecs_stats, k);
|
||||
k++;
|
||||
}
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#define METRIC_ONLY_LEN 20
|
||||
|
||||
static struct stats walltime_nsecs_stats;
|
||||
|
||||
struct perf_stat_config stat_config = {
|
||||
.aggr_mode = AGGR_GLOBAL,
|
||||
.aggr_level = MAX_CACHE_LVL + 1,
|
||||
|
||||
@@ -18,13 +18,6 @@
|
||||
#include "util/hashmap.h"
|
||||
#include "tool_pmu.h"
|
||||
|
||||
struct stats walltime_nsecs_stats;
|
||||
|
||||
void perf_stat__reset_shadow_stats(void)
|
||||
{
|
||||
memset(&walltime_nsecs_stats, 0, sizeof(walltime_nsecs_stats));
|
||||
}
|
||||
|
||||
static bool tool_pmu__is_time_event(const struct perf_stat_config *config,
|
||||
const struct evsel *evsel, int *tool_aggr_idx)
|
||||
{
|
||||
|
||||
@@ -129,8 +129,6 @@ static inline void init_stats(struct stats *stats)
|
||||
struct evsel;
|
||||
struct evlist;
|
||||
|
||||
extern struct stats walltime_nsecs_stats;
|
||||
|
||||
enum metric_threshold_classify {
|
||||
METRIC_THRESHOLD_UNKNOWN,
|
||||
METRIC_THRESHOLD_BAD,
|
||||
|
||||
Reference in New Issue
Block a user