summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2023-06-09 15:38:10 -0700
committerYabin Cui <yabinc@google.com>2023-06-09 15:38:25 -0700
commit924e56e8d0897146ffca06bce42af293b97ee09e (patch)
tree8b34ba9c9d38bcb1fc607ac203f205b5ef42ac14
parent74954de15a0d6730feac7f63c1a6338827d22abd (diff)
parent86f86677d38008c9756c3c09d4036bd1baa17aac (diff)
downloadextras-924e56e8d0897146ffca06bce42af293b97ee09e.tar.gz
resolve merge conflicts of 86f86677d38008c9756c3c09d4036bd1baa17aac to android12-tests-dev
Bug: 286585422 Test: build Change-Id: I4ca69cbfde11d05152a010f30b22acbac5fbbf0a
-rw-r--r--simpleperf/test_util.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/simpleperf/test_util.cpp b/simpleperf/test_util.cpp
index d85294f5..4a6c53d5 100644
--- a/simpleperf/test_util.cpp
+++ b/simpleperf/test_util.cpp
@@ -80,9 +80,10 @@ bool HasHardwareCounter() {
bool is_emulator = android::base::StartsWith(fingerprint, "google/sdk_gphone") ||
android::base::StartsWith(fingerprint, "generic/cf");
- if (arch == ARCH_X86_64 || arch == ARCH_X86_32 || is_emulator) {
- // On x86 and x86_64, it's likely to run on an emulator or vm without hardware perf
- // counters. It's hard to enumerate them all. So check the support at runtime.
+ if (arch == ARCH_X86_64 || arch == ARCH_X86_32 || !IsInNativeAbi() || is_emulator) {
+ // On x86 and x86_64, or when we are not in native abi, it's likely to run on an emulator or
+ // vm without hardware perf counters. It's hard to enumerate them all. So check the support
+ // at runtime.
const simpleperf::EventType* type = simpleperf::FindEventTypeByName("cpu-cycles", false);
CHECK(type != nullptr);
perf_event_attr attr = CreateDefaultPerfEventAttr(*type);