diff options
author | Yabin Cui <yabinc@google.com> | 2017-05-03 16:34:02 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2017-05-03 16:34:02 -0700 |
commit | df6333c5f5a34d4b7853c4671a53fcfd9e5a0b88 (patch) | |
tree | 7d5c9923a82717c784bb32aec89531c3dda7efc3 /simpleperf/record_file_reader.cpp | |
parent | c248f1f76182d7f5bf7f8d0a5432b4a7bc2befd2 (diff) | |
download | extras-df6333c5f5a34d4b7853c4671a53fcfd9e5a0b88.tar.gz |
simpleperf: add META_INFO feature section in perf.data.
META_INFO section can be used to pass some small information
in perf.data.
Add simpleperf_version in META_INFO section for debugging.
Bug: http://b/37960318
Test: run simpleperf_unit_test.
Change-Id: If17a147bbc77b5af063fbf77e02ca81430afb8a5
Diffstat (limited to 'simpleperf/record_file_reader.cpp')
-rw-r--r-- | simpleperf/record_file_reader.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/simpleperf/record_file_reader.cpp b/simpleperf/record_file_reader.cpp index 0fdb6ddc..67f35bea 100644 --- a/simpleperf/record_file_reader.cpp +++ b/simpleperf/record_file_reader.cpp @@ -434,6 +434,23 @@ bool RecordFileReader::ReadFileFeature(size_t& read_pos, return true; } +bool RecordFileReader::ReadMetaInfoFeature(std::unordered_map<std::string, std::string>* info_map) { + std::vector<char> buf; + if (!ReadFeatureSection(FEAT_META_INFO, &buf)) { + return false; + } + const char* p = buf.data(); + const char* end = buf.data() + buf.size(); + while (p < end) { + const char* key = p; + const char* value = key + strlen(key) + 1; + CHECK(value < end); + (*info_map)[p] = value; + p = value + strlen(value) + 1; + } + return true; +} + void RecordFileReader::LoadBuildIdAndFileFeatures(ThreadTree& thread_tree) { std::vector<BuildIdRecord> records = ReadBuildIdFeature(); std::vector<std::pair<std::string, BuildId>> build_ids; |