diff options
author | Chih-Hung Hsieh <chh@google.com> | 2020-02-11 14:12:37 -0800 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2020-02-11 14:12:37 -0800 |
commit | 3c5692007b8f7d0ca15fb6547871487a2fe73953 (patch) | |
tree | cbf4057b6e291544cad515e2b8ac0b5733860d43 | |
parent | 0e3245fdb39ccf2e8a5364084706ce5d6065c5a0 (diff) | |
download | extras-3c5692007b8f7d0ca15fb6547871487a2fe73953.tar.gz |
Fix clang-tidy performance-faster-string-find warnings
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: I43659675f256c2dcf6b9e9ef91977af5c03c4144
-rw-r--r-- | simpleperf/event_type.cpp | 4 | ||||
-rw-r--r-- | simpleperf/event_type.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/simpleperf/event_type.cpp b/simpleperf/event_type.cpp index c9eaa75b..71c3d9f1 100644 --- a/simpleperf/event_type.cpp +++ b/simpleperf/event_type.cpp @@ -161,7 +161,7 @@ static uint64_t MakeEventConfig(const std::string& event_str, std::vector<EventF // # cat armv8_pmuv3/events/cpu_cycles // event=0x011 for (auto& s : android::base::Split(event_str, ",")) { - auto pos = s.find("="); + auto pos = s.find('='); if (pos == std::string::npos) continue; @@ -229,7 +229,7 @@ std::vector<int> EventType::GetPmuCpumask() { if (!IsPmuEvent()) return empty_result; - std::string pmu = name.substr(0, name.find("/")); + std::string pmu = name.substr(0, name.find('/')); std::string cpumask_path = "/sys/bus/event_source/devices/" + pmu + "/cpumask"; std::string cpumask_content; if (!android::base::ReadFileToString(cpumask_path, &cpumask_content)) { diff --git a/simpleperf/event_type.h b/simpleperf/event_type.h index d4ffecb7..359438ec 100644 --- a/simpleperf/event_type.h +++ b/simpleperf/event_type.h @@ -44,7 +44,7 @@ struct EventType { } bool IsPmuEvent() const { - return name.find("/") != std::string::npos; + return name.find('/') != std::string::npos; } std::vector<int> GetPmuCpumask(); |