summaryrefslogtreecommitdiff
path: root/simpleperf
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2024-03-15 16:18:28 -0700
committerYabin Cui <yabinc@google.com>2024-03-15 16:44:33 -0700
commit6e03c480662d8a5de8b2931f4a3168e1df62b22f (patch)
tree995e757ecabda80cce370e8eb722ab175bb39b9d /simpleperf
parent0a775d8aead45c06dc1d2238901d5f4dc4089258 (diff)
downloadextras-6e03c480662d8a5de8b2931f4a3168e1df62b22f.tar.gz
profcollectd: Use system property to probe etr when needed
Bug: 321061072 Test: run profcollectd Change-Id: I41abdc2f7c8a83ebecaa4624bf4c8d0a8d3de988
Diffstat (limited to 'simpleperf')
-rw-r--r--simpleperf/profcollect.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/simpleperf/profcollect.cpp b/simpleperf/profcollect.cpp
index fcf66ca1..cc6fb5c0 100644
--- a/simpleperf/profcollect.cpp
+++ b/simpleperf/profcollect.cpp
@@ -17,6 +17,7 @@
#include <time.h>
#include <android-base/file.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@@ -55,6 +56,15 @@ bool IsETMDriverAvailable() {
bool IsETMDeviceAvailable() {
auto result = ETMRecorder::GetInstance().CheckEtmSupport();
if (!result.ok()) {
+ if (result.error().find("can't find etr device") != std::string::npos) {
+ // Trigger a manual probe of etr. It may take effect the next time running
+ // IsETMDeviceAvailable().
+ std::string prop_name = "profcollectd.etr.probe";
+ bool res = android::base::SetProperty(prop_name, "1");
+ if (!res) {
+ LOG(ERROR) << "fails to setprop" << prop_name;
+ }
+ }
LOG(INFO) << "HasDeviceSupport check failed: " << result.error();
return false;
}