diff options
author | Yabin Cui <yabinc@google.com> | 2018-07-25 17:20:52 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-07-25 17:20:52 -0700 |
commit | 4bf4bfaafdfb264ded7f4f9aeb6ad874dbe179d5 (patch) | |
tree | 184c0205623f9df3c2a85585107e7e3c5bd94b2c | |
parent | 0e5c69a63f1eeee368a715b4db549fbdec04aa1e (diff) | |
download | extras-4bf4bfaafdfb264ded7f4f9aeb6ad874dbe179d5.tar.gz |
simpleperf: enforce clockid support in Android Q.
It is needed to merge JIT symfiles into records precisely.
Bug: 110923759
Test: run simpleperf_unit_test.
Change-Id: I676dc5ca40f12145760d59cd786e9ee538abd728
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index 6cc82024..2f30df66 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -629,17 +629,16 @@ TEST(record_cmd, exit_with_parent_option) { TEST(record_cmd, clockid_option) { TEST_REQUIRE_HW_COUNTER(); - if (!IsSettingClockIdSupported()) { - ASSERT_FALSE(RunRecordCmd({"--clockid", "monotonic"})); - } else { - TemporaryFile tmpfile; - ASSERT_TRUE(RunRecordCmd({"--clockid", "monotonic"}, tmpfile.path)); - std::unique_ptr<RecordFileReader> reader = RecordFileReader::CreateInstance(tmpfile.path); - ASSERT_TRUE(reader); - std::unordered_map<std::string, std::string> info_map; - ASSERT_TRUE(reader->ReadMetaInfoFeature(&info_map)); - ASSERT_EQ(info_map["clockid"], "monotonic"); - } + // clockid is supported in kernel >= 4.1. If not supported, please cherry pick kernel patch: + // 34f439278cef7b perf: Add per event clockid support + ASSERT_TRUE(IsSettingClockIdSupported()); + TemporaryFile tmpfile; + ASSERT_TRUE(RunRecordCmd({"--clockid", "monotonic"}, tmpfile.path)); + std::unique_ptr<RecordFileReader> reader = RecordFileReader::CreateInstance(tmpfile.path); + ASSERT_TRUE(reader); + std::unordered_map<std::string, std::string> info_map; + ASSERT_TRUE(reader->ReadMetaInfoFeature(&info_map)); + ASSERT_EQ(info_map["clockid"], "monotonic"); } TEST(record_cmd, generate_samples_by_hw_counters) { |