Skip to content

Commit a563c9f

Browse files
captain5050namhyung
authored andcommitted
perf test: Move PERF_SAMPLE_WEIGHT_STRUCT parsing to common test
test__x86_sample_parsing is identical to test__sample_parsing except it explicitly tested PERF_SAMPLE_WEIGHT_STRUCT. Now the parsing code is common move the PERF_SAMPLE_WEIGHT_STRUCT to the common sample parsing test and remove the x86 version. Signed-off-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 8882095 commit a563c9f

File tree

5 files changed

+14
-129
lines changed

5 files changed

+14
-129
lines changed

tools/perf/arch/x86/include/arch-tests.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ int test__insn_x86(struct test_suite *test, int subtest);
1414
int test__intel_pt_pkt_decoder(struct test_suite *test, int subtest);
1515
int test__intel_pt_hybrid_compat(struct test_suite *test, int subtest);
1616
int test__bp_modify(struct test_suite *test, int subtest);
17-
int test__x86_sample_parsing(struct test_suite *test, int subtest);
1817
int test__amd_ibs_via_core_pmu(struct test_suite *test, int subtest);
1918
int test__amd_ibs_period(struct test_suite *test, int subtest);
2019
int test__hybrid(struct test_suite *test, int subtest);

tools/perf/arch/x86/tests/Build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ perf-test-$(CONFIG_DWARF_UNWIND) += regs_load.o
22
perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
33

44
perf-test-y += arch-tests.o
5-
perf-test-y += sample-parsing.o
65
perf-test-y += hybrid.o
76
perf-test-$(CONFIG_AUXTRACE) += intel-pt-test.o
87
ifeq ($(CONFIG_EXTRA_TESTS),y)

tools/perf/arch/x86/tests/arch-tests.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ struct test_suite suite__intel_pt = {
2323
#if defined(__x86_64__)
2424
DEFINE_SUITE("x86 bp modify", bp_modify);
2525
#endif
26-
DEFINE_SUITE("x86 Sample parsing", x86_sample_parsing);
2726
DEFINE_SUITE("AMD IBS via core pmu", amd_ibs_via_core_pmu);
2827
DEFINE_SUITE_EXCLUSIVE("AMD IBS sample period", amd_ibs_period);
2928
static struct test_case hybrid_tests[] = {
@@ -49,7 +48,6 @@ struct test_suite *arch_tests[] = {
4948
#if defined(__x86_64__)
5049
&suite__bp_modify,
5150
#endif
52-
&suite__x86_sample_parsing,
5351
&suite__amd_ibs_via_core_pmu,
5452
&suite__amd_ibs_period,
5553
&suite__hybrid,

tools/perf/arch/x86/tests/sample-parsing.c

Lines changed: 0 additions & 125 deletions
This file was deleted.

tools/perf/tests/sample-parsing.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ static bool samples_same(struct perf_sample *s1,
152152
if (type & PERF_SAMPLE_WEIGHT)
153153
COMP(weight);
154154

155+
if (type & PERF_SAMPLE_WEIGHT_STRUCT) {
156+
COMP(weight);
157+
COMP(ins_lat);
158+
COMP(weight3);
159+
}
160+
155161
if (type & PERF_SAMPLE_DATA_SRC)
156162
COMP(data_src);
157163

@@ -269,6 +275,8 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
269275
.cgroup = 114,
270276
.data_page_size = 115,
271277
.code_page_size = 116,
278+
.ins_lat = 117,
279+
.weight3 = 118,
272280
.aux_sample = {
273281
.size = sizeof(aux_data),
274282
.data = (void *)aux_data,
@@ -439,6 +447,12 @@ static int test__sample_parsing(struct test_suite *test __maybe_unused, int subt
439447
if (err)
440448
return err;
441449
}
450+
sample_type = (PERF_SAMPLE_MAX - 1) & ~PERF_SAMPLE_WEIGHT_STRUCT;
451+
for (i = 0; i < ARRAY_SIZE(rf); i++) {
452+
err = do_test(sample_type, sample_regs, rf[i]);
453+
if (err)
454+
return err;
455+
}
442456

443457
return 0;
444458
}

0 commit comments

Comments
 (0)