diff options
author | Yabin Cui <yabinc@google.com> | 2016-10-19 11:28:48 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-10-20 10:44:14 -0700 |
commit | 2597ef042881f834d1bc414930f144a405dd13ca (patch) | |
tree | c9b7ead971181d85d4746e0de3e5d75f2e7bef7c /simpleperf/record_test.cpp | |
parent | ed2e8624ef1afffc7973a91607515e42cbf15f03 (diff) | |
download | extras-2597ef042881f834d1bc414930f144a405dd13ca.tar.gz |
simpleperf: support building sample record manually.
And other small changes:
add time when building comm record.
move some Move*BinaryFormat to utils.h.
Handle wrong symbol whoes address can be ULLONG_MAX.
Bug: http://b/30974760
Test: simpleperf_unit_test.
Change-Id: I2956d3c4b781c580fe93a6e5b77e0469f7f4f43f
Diffstat (limited to 'simpleperf/record_test.cpp')
-rw-r--r-- | simpleperf/record_test.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/simpleperf/record_test.cpp b/simpleperf/record_test.cpp index da5a3ce3..45febc53 100644 --- a/simpleperf/record_test.cpp +++ b/simpleperf/record_test.cpp @@ -27,6 +27,7 @@ class RecordTest : public ::testing::Test { const EventType* type = FindEventTypeByName("cpu-cycles"); ASSERT_TRUE(type != nullptr); event_attr = CreateDefaultPerfEventAttr(*type); + event_attr.sample_id_all = 1; } void CheckRecordMatchBinary(const Record& record) { @@ -47,7 +48,15 @@ TEST_F(RecordTest, MmapRecordMatchBinary) { } TEST_F(RecordTest, CommRecordMatchBinary) { - CommRecord record(event_attr, 1, 2, "CommRecord", 0); + CommRecord record(event_attr, 1, 2, "CommRecord", 0, 7); + CheckRecordMatchBinary(record); +} + +TEST_F(RecordTest, SampleRecordMatchBinary) { + event_attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME + | PERF_SAMPLE_ID | PERF_SAMPLE_CPU + | PERF_SAMPLE_PERIOD | PERF_SAMPLE_CALLCHAIN; + SampleRecord record(event_attr, 1, 2, 3, 4, 5, 6, 7, {8, 9, 10}); CheckRecordMatchBinary(record); } |