summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-13 20:36:59 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-06-13 20:36:59 +0000
commit2b615d74e4e3081ac139dd79329336d22f8fa0b2 (patch)
tree81818522485239d0d3d09c1038634d1c51be3f0b
parent82a04af3fd217b6bf343520f559e55bb7315bd4e (diff)
parent21304f4101b4ae41165e524ebd02b5b222a1acd7 (diff)
downloadextras-android-cts-13.0_r5.tar.gz
Merge "Snap for 10311290 from c5db4be612569290dd3e1315588d674e64f650ee to android13-tests-release" into android13-tests-releaseandroid-vts-13.0_r8android-vts-13.0_r7android-vts-13.0_r6android-vts-13.0_r5android-cts-13.0_r8android-cts-13.0_r7android-cts-13.0_r6android-cts-13.0_r5
-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);