summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-14 16:39:21 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-14 16:39:21 +0000
commit95ab11317fe0452e89e08dd84b528f032d5daf9b (patch)
tree81818522485239d0d3d09c1038634d1c51be3f0b
parent850da358c1d087b1d1365ba6b3de5b089f1f93d6 (diff)
parenta88d8919b87b12c1dbecdcad6407b50d3c46c720 (diff)
downloadextras-aml_tz4_332714010.tar.gz
Snap for 11219529 from a88d8919b87b12c1dbecdcad6407b50d3c46c720 to mainline-tzdata4-releaseaml_tz4_332714070aml_tz4_332714050aml_tz4_332714010aml_tz4_332714010
Change-Id: I9344044d27fee445e700e89424c76bd50fda62ab
-rw-r--r--simpleperf/environment.cpp5
-rw-r--r--simpleperf/test_util.cpp7
2 files changed, 7 insertions, 5 deletions
diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp
index 8e95d449..9d698924 100644
--- a/simpleperf/environment.cpp
+++ b/simpleperf/environment.cpp
@@ -332,9 +332,10 @@ bool SetPerfEventLimits(uint64_t sample_freq, size_t cpu_percent, uint64_t mlock
}
// Wait for init process to change perf event limits based on properties.
const size_t max_wait_us = 3 * 1000000;
+ const size_t interval_us = 10000;
int finish_mask = 0;
- for (size_t i = 0; i < max_wait_us && finish_mask != 7; ++i) {
- usleep(1); // Wait 1us to avoid busy loop.
+ for (size_t i = 0; i < max_wait_us && finish_mask != 7; i += interval_us) {
+ usleep(interval_us); // Wait 10ms to avoid busy loop.
if ((finish_mask & 1) == 0) {
uint64_t freq;
if (!GetMaxSampleFrequency(&freq) || freq == sample_freq) {
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);