summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-13 20:34:59 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-06-13 20:34:59 +0000
commit7082585947da72cd7099f82f691188aa9782ab87 (patch)
tree15e572d7c373f6d0f06c59834d3f68b3f17b92e1
parent501b7a0bebe8b3ae4edcca0295498bd34c85198c (diff)
parent01bcc4dcb505d1019fb59cb2b3c36a69192a3908 (diff)
downloadextras-android-vts-12.1_r7.tar.gz
Merge "Snap for 10311110 from e8a7be73b36aa2d41aac368bc56a8d6f74ef1edd to android12L-tests-release" into android12L-tests-releaseandroid-vts-12.1_r9android-vts-12.1_r8android-vts-12.1_r7android-vts-12.1_r10android-cts-12.1_r9android-cts-12.1_r8android-cts-12.1_r7android-cts-12.1_r10
-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);