summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-13 03:22:09 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-06-13 03:22:09 +0000
commit847beb9ffe3fc1f1e65dbae43a02254704fde42a (patch)
treecdfdae9d9c0ff69dbc08745a9cfd57696cc0ae23
parent33d8e5fb6fe5f82f9a362c6daf9bd1ac97265451 (diff)
parent0b84e4f86d8544075f235e1eb753dbd8868c32af (diff)
downloadextras-847beb9ffe3fc1f1e65dbae43a02254704fde42a.tar.gz
Snap for 10309372 from 0b84e4f86d8544075f235e1eb753dbd8868c32af to udc-qpr1-release
Change-Id: I0917abdd397e4cdbeac7b1a797dc3a7148a9f13b
-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);