perf tools fixes for v5.15: 4th patch
- Fix 'perf test evsel' build error on !x86 architectures. - Fix libperf's test_stat_cpu mixup of CPU numbers and CPU indexes. - Output offsets for decompressed records, not just useless zeros. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCYWq4ZAAKCRCyPKLppCJ+ JyRdAQD1iZFc0g9GLL0n50Q6HJCAFDLfufbkTpYiPPTFhemDRgD9Em5IvOAW6Zhv 9xLhduRa0DfTe/NIxz82bjSD4BvuzQw= =JBso -----END PGP SIGNATURE----- Merge tag 'perf-tools-fixes-for-v5.15-2021-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix 'perf test evsel' build error on !x86 architectures - Fix libperf's test_stat_cpu mixup of CPU numbers and CPU indexes - Output offsets for decompressed records, not just useless zeros * tag 'perf-tools-fixes-for-v5.15-2021-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: libperf tests: Fix test_stat_cpu libperf test evsel: Fix build error on !x86 architectures perf report: Output non-zero offset for decompressed records
This commit is contained in:
commit
d999ade1cc
|
@ -40,7 +40,7 @@ static int test_stat_cpu(void)
|
|||
.type = PERF_TYPE_SOFTWARE,
|
||||
.config = PERF_COUNT_SW_TASK_CLOCK,
|
||||
};
|
||||
int err, cpu, tmp;
|
||||
int err, idx;
|
||||
|
||||
cpus = perf_cpu_map__new(NULL);
|
||||
__T("failed to create cpus", cpus);
|
||||
|
@ -70,10 +70,10 @@ static int test_stat_cpu(void)
|
|||
perf_evlist__for_each_evsel(evlist, evsel) {
|
||||
cpus = perf_evsel__cpus(evsel);
|
||||
|
||||
perf_cpu_map__for_each_cpu(cpu, tmp, cpus) {
|
||||
for (idx = 0; idx < perf_cpu_map__nr(cpus); idx++) {
|
||||
struct perf_counts_values counts = { .val = 0 };
|
||||
|
||||
perf_evsel__read(evsel, cpu, 0, &counts);
|
||||
perf_evsel__read(evsel, idx, 0, &counts);
|
||||
__T("failed to read value for evsel", counts.val != 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ static int test_stat_cpu(void)
|
|||
.type = PERF_TYPE_SOFTWARE,
|
||||
.config = PERF_COUNT_SW_CPU_CLOCK,
|
||||
};
|
||||
int err, cpu, tmp;
|
||||
int err, idx;
|
||||
|
||||
cpus = perf_cpu_map__new(NULL);
|
||||
__T("failed to create cpus", cpus);
|
||||
|
@ -33,10 +33,10 @@ static int test_stat_cpu(void)
|
|||
err = perf_evsel__open(evsel, cpus, NULL);
|
||||
__T("failed to open evsel", err == 0);
|
||||
|
||||
perf_cpu_map__for_each_cpu(cpu, tmp, cpus) {
|
||||
for (idx = 0; idx < perf_cpu_map__nr(cpus); idx++) {
|
||||
struct perf_counts_values counts = { .val = 0 };
|
||||
|
||||
perf_evsel__read(evsel, cpu, 0, &counts);
|
||||
perf_evsel__read(evsel, idx, 0, &counts);
|
||||
__T("failed to read value for evsel", counts.val != 0);
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,7 @@ static int test_stat_user_read(int event)
|
|||
__T("failed to mmap evsel", err == 0);
|
||||
|
||||
pc = perf_evsel__mmap_base(evsel, 0, 0);
|
||||
__T("failed to get mmapped address", pc);
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
__T("userspace counter access not supported", pc->cap_user_rdpmc);
|
||||
|
|
|
@ -2116,7 +2116,7 @@ fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)
|
|||
static int __perf_session__process_decomp_events(struct perf_session *session)
|
||||
{
|
||||
s64 skip;
|
||||
u64 size, file_pos = 0;
|
||||
u64 size;
|
||||
struct decomp *decomp = session->decomp_last;
|
||||
|
||||
if (!decomp)
|
||||
|
@ -2132,7 +2132,7 @@ static int __perf_session__process_decomp_events(struct perf_session *session)
|
|||
size = event->header.size;
|
||||
|
||||
if (size < sizeof(struct perf_event_header) ||
|
||||
(skip = perf_session__process_event(session, event, file_pos)) < 0) {
|
||||
(skip = perf_session__process_event(session, event, decomp->file_pos)) < 0) {
|
||||
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
|
||||
decomp->file_pos + decomp->head, event->header.size, event->header.type);
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue