diff options
author | Ingo Molnar <mingo@kernel.org> | 2019-09-20 12:14:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-09-20 12:16:42 -0400 |
commit | 351a1f5c8afa13ea5cfcdae543f6596ef8ebdbd9 (patch) | |
tree | 6d039ac0d47666bd6de701911a283c51bea7105e /tools/perf/util/stat.c | |
parent | 7f2444d38f6bbfa12bc15e2533d8f9daa85ca02b (diff) | |
parent | 2bff2b828502b5e5d5ea5a52643d3542053df03f (diff) |
Merge tag 'perf-core-for-mingo-5.4-20190920-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
perf stat:
Srikar Dronamraju:
- Fix a segmentation fault when using repeat forever.
- Reset previous counts on repeat with interval.
aarch64:
James Clark:
- Add PMU event JSON files for Cortex-A76 and Neoverse N1.
PowerPC:
Anju T Sudhakar:
- Make 'trace_cycles' the default event for 'perf kvm record' in PowerPC.
S/390:
- Link libjvmti to tools/lib/string.o to have a weak strlcpy()
implementation, providing previously unresolved symbol on s/390.
perf test:
Jiri Olsa:
- Add libperf automated tests to 'make -C tools/perf build-test'.
Colin Ian King:
- Fix spelling mistake.
Tree wide:
Arnaldo Carvalho de Melo:
- Some more header file sanitization.
libperf:
Jiri Olsa:
- Add dependency on libperf for python.so binding.
libtraceevent:
Sakari Ailus:
- Convert remaining %p[fF] users to %p[sS].
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/stat.c')
-rw-r--r-- | tools/perf/util/stat.c | 60 |
1 files changed, 18 insertions, 42 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 8f1ea27f976f..fcd54342c04c 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <math.h> | 4 | #include <math.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include "counts.h" | 6 | #include "counts.h" |
7 | #include "cpumap.h" | ||
7 | #include "debug.h" | 8 | #include "debug.h" |
8 | #include "header.h" | 9 | #include "header.h" |
9 | #include "stat.h" | 10 | #include "stat.h" |
@@ -161,6 +162,15 @@ static void perf_evsel__free_prev_raw_counts(struct evsel *evsel) | |||
161 | evsel->prev_raw_counts = NULL; | 162 | evsel->prev_raw_counts = NULL; |
162 | } | 163 | } |
163 | 164 | ||
165 | static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel) | ||
166 | { | ||
167 | if (evsel->prev_raw_counts) { | ||
168 | evsel->prev_raw_counts->aggr.val = 0; | ||
169 | evsel->prev_raw_counts->aggr.ena = 0; | ||
170 | evsel->prev_raw_counts->aggr.run = 0; | ||
171 | } | ||
172 | } | ||
173 | |||
164 | static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) | 174 | static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) |
165 | { | 175 | { |
166 | int ncpus = perf_evsel__nr_cpus(evsel); | 176 | int ncpus = perf_evsel__nr_cpus(evsel); |
@@ -211,6 +221,14 @@ void perf_evlist__reset_stats(struct evlist *evlist) | |||
211 | } | 221 | } |
212 | } | 222 | } |
213 | 223 | ||
224 | void perf_evlist__reset_prev_raw_counts(struct evlist *evlist) | ||
225 | { | ||
226 | struct evsel *evsel; | ||
227 | |||
228 | evlist__for_each_entry(evlist, evsel) | ||
229 | perf_evsel__reset_prev_raw_counts(evsel); | ||
230 | } | ||
231 | |||
214 | static void zero_per_pkg(struct evsel *counter) | 232 | static void zero_per_pkg(struct evsel *counter) |
215 | { | 233 | { |
216 | if (counter->per_pkg_mask) | 234 | if (counter->per_pkg_mask) |
@@ -493,45 +511,3 @@ int create_perf_stat_counter(struct evsel *evsel, | |||
493 | 511 | ||
494 | return perf_evsel__open_per_thread(evsel, evsel->core.threads); | 512 | return perf_evsel__open_per_thread(evsel, evsel->core.threads); |
495 | } | 513 | } |
496 | |||
497 | int perf_stat_synthesize_config(struct perf_stat_config *config, | ||
498 | struct perf_tool *tool, | ||
499 | struct evlist *evlist, | ||
500 | perf_event__handler_t process, | ||
501 | bool attrs) | ||
502 | { | ||
503 | int err; | ||
504 | |||
505 | if (attrs) { | ||
506 | err = perf_event__synthesize_attrs(tool, evlist, process); | ||
507 | if (err < 0) { | ||
508 | pr_err("Couldn't synthesize attrs.\n"); | ||
509 | return err; | ||
510 | } | ||
511 | } | ||
512 | |||
513 | err = perf_event__synthesize_extra_attr(tool, evlist, process, | ||
514 | attrs); | ||
515 | |||
516 | err = perf_event__synthesize_thread_map2(tool, evlist->core.threads, | ||
517 | process, NULL); | ||
518 | if (err < 0) { | ||
519 | pr_err("Couldn't synthesize thread map.\n"); | ||
520 | return err; | ||
521 | } | ||
522 | |||
523 | err = perf_event__synthesize_cpu_map(tool, evlist->core.cpus, | ||
524 | process, NULL); | ||
525 | if (err < 0) { | ||
526 | pr_err("Couldn't synthesize thread map.\n"); | ||
527 | return err; | ||
528 | } | ||
529 | |||
530 | err = perf_event__synthesize_stat_config(tool, config, process, NULL); | ||
531 | if (err < 0) { | ||
532 | pr_err("Couldn't synthesize config.\n"); | ||
533 | return err; | ||
534 | } | ||
535 | |||
536 | return 0; | ||
537 | } | ||