diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/tests/parse-events.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index f65bb89e109e..9b6b2b6324a1 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -479,6 +479,39 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist) | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | 481 | ||
482 | static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist *evlist) | ||
483 | { | ||
484 | struct perf_evsel *evsel = perf_evlist__first(evlist); | ||
485 | |||
486 | /* cpu/config=1,call-graph=fp,time,period=100000/ */ | ||
487 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
488 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); | ||
489 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); | ||
490 | /* | ||
491 | * The period, time and callgraph value gets configured | ||
492 | * within perf_evlist__config, | ||
493 | * while this test executes only parse events method. | ||
494 | */ | ||
495 | TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period); | ||
496 | TEST_ASSERT_VAL("wrong callgraph", !(PERF_SAMPLE_CALLCHAIN & evsel->attr.sample_type)); | ||
497 | TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->attr.sample_type)); | ||
498 | |||
499 | /* cpu/config=2,call-graph=no,time=0,period=2000/ */ | ||
500 | evsel = perf_evsel__next(evsel); | ||
501 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); | ||
502 | TEST_ASSERT_VAL("wrong config", 2 == evsel->attr.config); | ||
503 | /* | ||
504 | * The period, time and callgraph value gets configured | ||
505 | * within perf_evlist__config, | ||
506 | * while this test executes only parse events method. | ||
507 | */ | ||
508 | TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period); | ||
509 | TEST_ASSERT_VAL("wrong callgraph", !(PERF_SAMPLE_CALLCHAIN & evsel->attr.sample_type)); | ||
510 | TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->attr.sample_type)); | ||
511 | |||
512 | return 0; | ||
513 | } | ||
514 | |||
482 | static int test__checkevent_pmu_events(struct perf_evlist *evlist) | 515 | static int test__checkevent_pmu_events(struct perf_evlist *evlist) |
483 | { | 516 | { |
484 | struct perf_evsel *evsel = perf_evlist__first(evlist); | 517 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
@@ -1555,6 +1588,11 @@ static struct evlist_test test__events_pmu[] = { | |||
1555 | .check = test__checkevent_pmu_name, | 1588 | .check = test__checkevent_pmu_name, |
1556 | .id = 1, | 1589 | .id = 1, |
1557 | }, | 1590 | }, |
1591 | { | ||
1592 | .name = "cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/", | ||
1593 | .check = test__checkevent_pmu_partial_time_callgraph, | ||
1594 | .id = 2, | ||
1595 | }, | ||
1558 | }; | 1596 | }; |
1559 | 1597 | ||
1560 | struct terms_test { | 1598 | struct terms_test { |