Lines Matching refs:evsel
80 static void evsel__reset_aggr_stats(struct evsel *evsel) in evsel__reset_aggr_stats() argument
82 struct perf_stat_evsel *ps = evsel->stats; in evsel__reset_aggr_stats()
89 static void evsel__reset_stat_priv(struct evsel *evsel) in evsel__reset_stat_priv() argument
91 struct perf_stat_evsel *ps = evsel->stats; in evsel__reset_stat_priv()
94 evsel__reset_aggr_stats(evsel); in evsel__reset_stat_priv()
97 static int evsel__alloc_aggr_stats(struct evsel *evsel, int nr_aggr) in evsel__alloc_aggr_stats() argument
99 struct perf_stat_evsel *ps = evsel->stats; in evsel__alloc_aggr_stats()
114 struct evsel *evsel; in evlist__alloc_aggr_stats() local
116 evlist__for_each_entry(evlist, evsel) { in evlist__alloc_aggr_stats()
117 if (evsel__alloc_aggr_stats(evsel, nr_aggr) < 0) in evlist__alloc_aggr_stats()
123 static int evsel__alloc_stat_priv(struct evsel *evsel, int nr_aggr) in evsel__alloc_stat_priv() argument
131 evsel->stats = ps; in evsel__alloc_stat_priv()
133 if (nr_aggr && evsel__alloc_aggr_stats(evsel, nr_aggr) < 0) { in evsel__alloc_stat_priv()
134 evsel->stats = NULL; in evsel__alloc_stat_priv()
139 evsel__reset_stat_priv(evsel); in evsel__alloc_stat_priv()
143 static void evsel__free_stat_priv(struct evsel *evsel) in evsel__free_stat_priv() argument
145 struct perf_stat_evsel *ps = evsel->stats; in evsel__free_stat_priv()
151 zfree(&evsel->stats); in evsel__free_stat_priv()
154 static int evsel__alloc_prev_raw_counts(struct evsel *evsel) in evsel__alloc_prev_raw_counts() argument
156 int cpu_map_nr = evsel__nr_cpus(evsel); in evsel__alloc_prev_raw_counts()
157 int nthreads = perf_thread_map__nr(evsel->core.threads); in evsel__alloc_prev_raw_counts()
162 evsel->prev_raw_counts = counts; in evsel__alloc_prev_raw_counts()
167 static void evsel__free_prev_raw_counts(struct evsel *evsel) in evsel__free_prev_raw_counts() argument
169 perf_counts__delete(evsel->prev_raw_counts); in evsel__free_prev_raw_counts()
170 evsel->prev_raw_counts = NULL; in evsel__free_prev_raw_counts()
173 static void evsel__reset_prev_raw_counts(struct evsel *evsel) in evsel__reset_prev_raw_counts() argument
175 if (evsel->prev_raw_counts) in evsel__reset_prev_raw_counts()
176 perf_counts__reset(evsel->prev_raw_counts); in evsel__reset_prev_raw_counts()
179 static int evsel__alloc_stats(struct evsel *evsel, int nr_aggr, bool alloc_raw) in evsel__alloc_stats() argument
181 if (evsel__alloc_stat_priv(evsel, nr_aggr) < 0 || in evsel__alloc_stats()
182 evsel__alloc_counts(evsel) < 0 || in evsel__alloc_stats()
183 (alloc_raw && evsel__alloc_prev_raw_counts(evsel) < 0)) in evsel__alloc_stats()
192 struct evsel *evsel; in evlist__alloc_stats() local
198 evlist__for_each_entry(evlist, evsel) { in evlist__alloc_stats()
199 if (evsel__alloc_stats(evsel, nr_aggr, alloc_raw)) in evlist__alloc_stats()
212 struct evsel *evsel; in evlist__free_stats() local
214 evlist__for_each_entry(evlist, evsel) { in evlist__free_stats()
215 evsel__free_stat_priv(evsel); in evlist__free_stats()
216 evsel__free_counts(evsel); in evlist__free_stats()
217 evsel__free_prev_raw_counts(evsel); in evlist__free_stats()
223 struct evsel *evsel; in evlist__reset_stats() local
225 evlist__for_each_entry(evlist, evsel) { in evlist__reset_stats()
226 evsel__reset_stat_priv(evsel); in evlist__reset_stats()
227 evsel__reset_counts(evsel); in evlist__reset_stats()
233 struct evsel *evsel; in evlist__reset_aggr_stats() local
235 evlist__for_each_entry(evlist, evsel) in evlist__reset_aggr_stats()
236 evsel__reset_aggr_stats(evsel); in evlist__reset_aggr_stats()
241 struct evsel *evsel; in evlist__reset_prev_raw_counts() local
243 evlist__for_each_entry(evlist, evsel) in evlist__reset_prev_raw_counts()
244 evsel__reset_prev_raw_counts(evsel); in evlist__reset_prev_raw_counts()
247 static void evsel__copy_prev_raw_counts(struct evsel *evsel) in evsel__copy_prev_raw_counts() argument
249 int idx, nthreads = perf_thread_map__nr(evsel->core.threads); in evsel__copy_prev_raw_counts()
252 perf_cpu_map__for_each_idx(idx, evsel__cpus(evsel)) { in evsel__copy_prev_raw_counts()
253 *perf_counts(evsel->counts, idx, thread) = in evsel__copy_prev_raw_counts()
254 *perf_counts(evsel->prev_raw_counts, idx, thread); in evsel__copy_prev_raw_counts()
261 struct evsel *evsel; in evlist__copy_prev_raw_counts() local
263 evlist__for_each_entry(evlist, evsel) in evlist__copy_prev_raw_counts()
264 evsel__copy_prev_raw_counts(evsel); in evlist__copy_prev_raw_counts()
267 static void evsel__copy_res_stats(struct evsel *evsel) in evsel__copy_res_stats() argument
269 struct perf_stat_evsel *ps = evsel->stats; in evsel__copy_res_stats()
280 struct evsel *evsel; in evlist__copy_res_stats() local
285 evlist__for_each_entry(evlist, evsel) in evlist__copy_res_stats()
286 evsel__copy_res_stats(evsel); in evlist__copy_res_stats()
304 static int check_per_pkg(struct evsel *counter, struct perf_counts_values *vals, in check_per_pkg()
366 static bool evsel__count_has_error(struct evsel *evsel, in evsel__count_has_error() argument
371 if (evsel->err || evsel->counts->scaled == -1) in evsel__count_has_error()
386 process_counter_values(struct perf_stat_config *config, struct evsel *evsel, in process_counter_values() argument
390 struct perf_stat_evsel *ps = evsel->stats; in process_counter_values()
394 if (check_per_pkg(evsel, count, cpu_map_idx, &skip)) { in process_counter_values()
402 if (!evsel->snapshot) in process_counter_values()
403 evsel__compute_deltas(evsel, cpu_map_idx, thread, count); in process_counter_values()
425 struct perf_cpu cpu = perf_cpu_map__cpu(evsel->core.cpus, cpu_map_idx); in process_counter_values()
442 if (evsel__count_has_error(evsel, count, config) && !ps_aggr->failed) { in process_counter_values()
462 struct evsel *counter) in process_counter_maps()
480 struct evsel *counter) in perf_stat_process_counter()
511 static int evsel__merge_aggr_counters(struct evsel *evsel, struct evsel *alias) in evsel__merge_aggr_counters() argument
513 struct perf_stat_evsel *ps_a = evsel->stats; in evsel__merge_aggr_counters()
539 static void evsel__merge_aliases(struct evsel *evsel) in evsel__merge_aliases() argument
541 struct evlist *evlist = evsel->evlist; in evsel__merge_aliases()
542 struct evsel *alias; in evsel__merge_aliases()
544 alias = list_prepare_entry(evsel, &(evlist->core.entries), core.node); in evsel__merge_aliases()
546 if (alias->first_wildcard_match == evsel) { in evsel__merge_aliases()
548 evsel__merge_aggr_counters(evsel, alias); in evsel__merge_aliases()
553 static bool evsel__should_merge_hybrid(const struct evsel *evsel, in evsel__should_merge_hybrid() argument
556 return config->hybrid_merge && evsel__is_hybrid(evsel); in evsel__should_merge_hybrid()
559 static void evsel__merge_stats(struct evsel *evsel, struct perf_stat_config *config) in evsel__merge_stats() argument
561 if (!evsel->pmu || !evsel->pmu->is_core || evsel__should_merge_hybrid(evsel, config)) in evsel__merge_stats()
562 evsel__merge_aliases(evsel); in evsel__merge_stats()
568 struct evsel *evsel; in perf_stat_merge_counters() local
573 evlist__for_each_entry(evlist, evsel) in perf_stat_merge_counters()
574 evsel__merge_stats(evsel, config); in perf_stat_merge_counters()
577 static void evsel__update_percore_stats(struct evsel *evsel, struct aggr_cpu_id *core_id) in evsel__update_percore_stats() argument
579 struct perf_stat_evsel *ps = evsel->stats; in evsel__update_percore_stats()
586 perf_cpu_map__for_each_cpu(cpu, idx, evsel->core.cpus) { in evsel__update_percore_stats()
599 perf_cpu_map__for_each_cpu(cpu, idx, evsel->core.cpus) { in evsel__update_percore_stats()
615 static void evsel__process_percore(struct evsel *evsel) in evsel__process_percore() argument
617 struct perf_stat_evsel *ps = evsel->stats; in evsel__process_percore()
622 if (!evsel->percore) in evsel__process_percore()
625 perf_cpu_map__for_each_cpu(cpu, idx, evsel->core.cpus) { in evsel__process_percore()
632 evsel__update_percore_stats(evsel, &core_id); in evsel__process_percore()
639 struct evsel *evsel; in perf_stat_process_percore() local
644 evlist__for_each_entry(evlist, evsel) in perf_stat_process_percore()
645 evsel__process_percore(evsel); in perf_stat_process_percore()
653 struct evsel *counter; in perf_event__process_stat_event()
720 int create_perf_stat_counter(struct evsel *evsel, in create_perf_stat_counter() argument
725 struct perf_event_attr *attr = &evsel->core.attr; in create_perf_stat_counter()
726 struct evsel *leader = evsel__leader(evsel); in create_perf_stat_counter()
739 attr->inherit = !config->no_inherit && list_empty(&evsel->bpf_counter_list); in create_perf_stat_counter()
765 if (evsel__is_group_leader(evsel)) { in create_perf_stat_counter()
772 return evsel__open_per_cpu_and_thread(evsel, evsel__cpus(evsel), cpu_map_idx, in create_perf_stat_counter()
773 evsel->core.threads); in create_perf_stat_counter()