Skip to content

Commit c744429

Browse files
Kan Liangacmel
authored andcommitted
perf test: Support PERF_SAMPLE_WEIGHT_STRUCT
Support the new sample type for sample-parsing test case. Signed-off-by: Kan Liang <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 590db42 commit c744429

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tools/perf/tests/sample-parsing.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ static bool samples_same(const struct perf_sample *s1,
129129
if (type & PERF_SAMPLE_WEIGHT)
130130
COMP(weight);
131131

132+
if (type & PERF_SAMPLE_WEIGHT_STRUCT)
133+
COMP(ins_lat);
134+
132135
if (type & PERF_SAMPLE_DATA_SRC)
133136
COMP(data_src);
134137

@@ -242,6 +245,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
242245
.cgroup = 114,
243246
.data_page_size = 115,
244247
.code_page_size = 116,
248+
.ins_lat = 117,
245249
.aux_sample = {
246250
.size = sizeof(aux_data),
247251
.data = (void *)aux_data,
@@ -348,7 +352,7 @@ int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_u
348352
* were added. Please actually update the test rather than just change
349353
* the condition below.
350354
*/
351-
if (PERF_SAMPLE_MAX > PERF_SAMPLE_CODE_PAGE_SIZE << 1) {
355+
if (PERF_SAMPLE_MAX > PERF_SAMPLE_WEIGHT_STRUCT << 1) {
352356
pr_debug("sample format has changed, some new PERF_SAMPLE_ bit was introduced - test needs updating\n");
353357
return -1;
354358
}
@@ -378,8 +382,12 @@ int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_u
378382
return err;
379383
}
380384

381-
/* Test all sample format bits together */
382-
sample_type = PERF_SAMPLE_MAX - 1;
385+
/*
386+
* Test all sample format bits together
387+
* Note: PERF_SAMPLE_WEIGHT and PERF_SAMPLE_WEIGHT_STRUCT cannot
388+
* be set simultaneously.
389+
*/
390+
sample_type = (PERF_SAMPLE_MAX - 1) & ~PERF_SAMPLE_WEIGHT;
383391
sample_regs = 0x3fff; /* shared yb intr and user regs */
384392
for (i = 0; i < ARRAY_SIZE(rf); i++) {
385393
err = do_test(sample_type, sample_regs, rf[i]);

0 commit comments

Comments
 (0)