summaryrefslogtreecommitdiff
path: root/simpleperf/environment.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-06-07 15:52:57 -0700
committerYabin Cui <yabinc@google.com>2018-06-07 15:55:17 -0700
commit8faa615e6ab0251c8372eaba32d26a6484ad28b5 (patch)
tree05b4d401b546e56e16595c983866d1b9979d5a13 /simpleperf/environment.cpp
parentc454e5afc90c3d0bac8931f59a44c40ee31cd252 (diff)
downloadextras-8faa615e6ab0251c8372eaba32d26a6484ad28b5.tar.gz
simpleperf: add whitelist to omit tests requiring hw counters.
Some Socs like i.MX6 Quad doesn't support PMU, so omit tests requiring hw counters on them. Bug: 80501046 Test: run CtsSimpleperfTestCase on a device not having Test: hw counters. Change-Id: Ibbc0128846d014b47b3f0b36f42992523f8782cd
Diffstat (limited to 'simpleperf/environment.cpp')
-rw-r--r--simpleperf/environment.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp
index 0a0a72ca..092e3ea8 100644
--- a/simpleperf/environment.cpp
+++ b/simpleperf/environment.cpp
@@ -727,3 +727,16 @@ int GetAndroidVersion() {
#endif // defined(__ANDROID__)
return 0;
}
+
+std::string GetHardwareFromCpuInfo(const std::string& cpu_info) {
+ for (auto& line : android::base::Split(cpu_info, "\n")) {
+ size_t pos = line.find(':');
+ if (pos != std::string::npos) {
+ std::string key = android::base::Trim(line.substr(0, pos));
+ if (key == "Hardware") {
+ return android::base::Trim(line.substr(pos + 1));
+ }
+ }
+ }
+ return "";
+}