summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-12 20:54:29 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-12 20:54:29 +0000
commit280ef3c922a8438594fe66799d5d1a7afdecb499 (patch)
tree56a8b0b7c934ce287ef4bc8dfc55e6d50f9a4e0f
parent2b5a85e79458262c765b25fea40d086e7922d8d5 (diff)
parentfe5a84f17a565adde9f61747b7da98b656e6c7e5 (diff)
downloadextras-280ef3c922a8438594fe66799d5d1a7afdecb499.tar.gz
Merge "Merge "Merge "resolve merge conflicts of 86f86677d38008c9756c3c09d4036bd1baa17aac to android12-tests-dev" into android12-tests-dev am: e89e097679" into android12L-tests-dev am: e8a7be73b3" into android13-tests-dev am: c5db4be612 am: bcf5ca7156 am: fe5a84f17a
Original change: https://android-review.googlesource.com/c/platform/system/extras/+/2621312 Change-Id: I992d7fd0cd8501b23b9e48d2bb84cfac66f9fa51 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 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);