diff options
author | Yabin Cui <yabinc@google.com> | 2016-10-24 19:13:09 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-10-26 17:08:13 -0700 |
commit | 2ea6de11962fea5613f15308b202fb505e57ae9b (patch) | |
tree | b0e52846150f77724aa8c2e4d6500d06b58b13cd /simpleperf/record.cpp | |
parent | e7448f00cf02ebe92f41881cf9c4b198cadbb8af (diff) | |
download | extras-2ea6de11962fea5613f15308b202fb505e57ae9b.tar.gz |
simpleperf: merge records from different buffers in memory.
By reading records from all buffers at once, we can merge records
in memory instead of sorting them in perf.data. To make it clear,
this patch only contains the code to merge records in memory, and
I will remove old method later.
Bug: http://b/32343227
Test: run simpleperf_unit_test.
Test: run simpleperf_runtest.py.
Change-Id: Iea2da06c072243c2014f43c8aa6d96a23cfb9123
Diffstat (limited to 'simpleperf/record.cpp')
-rw-r--r-- | simpleperf/record.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/simpleperf/record.cpp b/simpleperf/record.cpp index be92ac1b..86da0657 100644 --- a/simpleperf/record.cpp +++ b/simpleperf/record.cpp @@ -918,6 +918,12 @@ std::vector<std::unique_ptr<Record>> ReadRecordsFromBuffer( return result; } +std::unique_ptr<Record> ReadRecordFromBuffer(const perf_event_attr& attr, + const char* p) { + auto header = reinterpret_cast<const perf_event_header*>(p); + return ReadRecordFromBuffer(attr, header->type, p); +} + bool RecordCache::RecordWithSeq::IsHappensBefore( const RecordWithSeq& other) const { bool is_sample = (record->type() == PERF_RECORD_SAMPLE); |