diff options
| author | Kan Liang <kan.liang@intel.com> | 2015-08-11 06:30:50 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-08-12 12:20:29 -0400 |
| commit | 71ef150ee06df29c5b427307dc0bacfe06a8baea (patch) | |
| tree | 8b0ed53246df201d073e8fd6dd47304994b15f5b | |
| parent | 9e207ddfa20781e56465ce9a537f0a377c9d34fb (diff) | |
perf tests: Add tests to callgraph and time parse
Add tests in tests/parse-events.c to check call-graph and time option.
Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1439289050-40510-4-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -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 { |
