summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-18 21:33:59 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-18 21:33:59 +0000
commit7c53f6ca06cd644af0a7a603b46a062a6ddd97bb (patch)
tree81818522485239d0d3d09c1038634d1c51be3f0b
parentbc101cf1400c3407f4fc6cc4149089ac1bd046b1 (diff)
parenta88d8919b87b12c1dbecdcad6407b50d3c46c720 (diff)
downloadextras-7c53f6ca06cd644af0a7a603b46a062a6ddd97bb.tar.gz
Snap for 10339911 from a88d8919b87b12c1dbecdcad6407b50d3c46c720 to mainline-mediaprovider-release
Change-Id: I3859bbff1d1ed3e52c3c20fc0b71bc2c784882ef
-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 43e21831..8ec4e669 100644
--- a/simpleperf/test_util.cpp
+++ b/simpleperf/test_util.cpp
@@ -81,9 +81,10 @@ bool HasHardwareCounter() {
android::base::StartsWith(fingerprint, "google/sdk_gpc") ||
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);