summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2023-06-12 17:43:45 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-12 17:43:45 +0000
commitb96b47e875e44254952a5046f58171b56ded7da4 (patch)
tree15e572d7c373f6d0f06c59834d3f68b3f17b92e1
parent04747534f83b21cdf5efb6bf7586b719c05be7c7 (diff)
parente89e0976796aa8c4a6a2091f7344e613e9b0de02 (diff)
downloadextras-b96b47e875e44254952a5046f58171b56ded7da4.tar.gz
Merge "resolve merge conflicts of 86f86677d38008c9756c3c09d4036bd1baa17aac to android12-tests-dev" into android12-tests-dev am: e89e097679
Original change: https://android-review.googlesource.com/c/platform/system/extras/+/2621312 Change-Id: I9bacb4ff2ce7fcd4fde62c85d13b8955082532ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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 fcbdf98f..fdad1a82 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);