diff options
author | Yabin Cui <yabinc@google.com> | 2016-04-01 20:22:35 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-04-05 16:52:47 -0700 |
commit | 2d6efe4b167da4e6b77f168b1820239ee65599e2 (patch) | |
tree | 631aced5c7cb30b3c93345c55e67fe329fdf1d1a /simpleperf/record_file_test.cpp | |
parent | 96e12e78722988e912664b7323341799fdd12b9b (diff) | |
download | extras-2d6efe4b167da4e6b77f168b1820239ee65599e2.tar.gz |
simpleperf: support reporting more than one event type.
When sampling kernel trace points, it is like to sample more than
one even type. Like `simpleperf record -e kmem:mm_page_alloc,kmem:mm_page_free`.
1. change record command to dump event_id for all records.
2. change report command and record reader to support multiple
event attrs.
3. hide record_cache inside EventSelectionSet.
4. add test to report multiple event types.
Bug: 27403614
Change-Id: Ic22a5527d68e7a843e3cf95e85381f8ad6bcb196
Diffstat (limited to 'simpleperf/record_file_test.cpp')
-rw-r--r-- | simpleperf/record_file_test.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/simpleperf/record_file_test.cpp b/simpleperf/record_file_test.cpp index 4648a649..96d1e53f 100644 --- a/simpleperf/record_file_test.cpp +++ b/simpleperf/record_file_test.cpp @@ -38,6 +38,7 @@ class RecordFileTest : public ::testing::Test { std::unique_ptr<EventTypeAndModifier> event_type_modifier = ParseEventType(event_type_str); ASSERT_TRUE(event_type_modifier != nullptr); perf_event_attr attr = CreateDefaultPerfEventAttr(event_type_modifier->event_type); + attr.sample_id_all = 1; attrs_.push_back(std::unique_ptr<perf_event_attr>(new perf_event_attr(attr))); AttrWithId attr_id; attr_id.attr = attrs_.back().get(); @@ -61,7 +62,7 @@ TEST_F(RecordFileTest, smoke) { // Write data section. MmapRecord mmap_record = CreateMmapRecord(*(attr_ids_[0].attr), true, 1, 1, 0x1000, 0x2000, - 0x3000, "mmap_record_example"); + 0x3000, "mmap_record_example", attr_ids_[0].ids[0]); ASSERT_TRUE(writer->WriteData(mmap_record.BinaryFormat())); // Write feature section. @@ -111,7 +112,8 @@ TEST_F(RecordFileTest, records_sorted_by_time) { // Write data section. MmapRecord r1 = - CreateMmapRecord(*(attr_ids_[0].attr), true, 1, 1, 0x100, 0x2000, 0x3000, "mmap_record1"); + CreateMmapRecord(*(attr_ids_[0].attr), true, 1, 1, 0x100, 0x2000, 0x3000, "mmap_record1", + attr_ids_[0].ids[0]); MmapRecord r2 = r1; MmapRecord r3 = r1; r1.sample_id.time_data.time = 2; |