summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-16 18:22:49 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-16 18:22:49 +0000
commit044bdafddc91bb4c80e295224d89ee1ce3005c32 (patch)
tree90bb3813b2e964d5e7e5c3cb42cc08f6e267240e
parent0964cddc56e0dd8229f56c79addf1aa261bb3cc9 (diff)
parentfd728c6783413a814a932a5fd7c4f140fe596786 (diff)
downloadextras-frc_340819020.tar.gz
Snap for 10337615 from fd728c6783413a814a932a5fd7c4f140fe596786 to aml-frc-releasefrc_340821000frc_340819280frc_340819220frc_340819190frc_340819030frc_340819020frc_340819010frc_340818170frc_340818110
Change-Id: I7711fe3f1138a1db48c115ec42ea730828d510ac
-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 d93ddcd8..60d8ea35 100644
--- a/simpleperf/test_util.cpp
+++ b/simpleperf/test_util.cpp
@@ -85,9 +85,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);