summaryrefslogtreecommitdiff
path: root/profcollectd
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2020-07-16 01:27:10 +0800
committerYi Kong <yikong@google.com>2020-07-16 01:45:30 +0800
commitf769e5c401c2a7db50c9df57f960a9a70bb8476e (patch)
treed0b235159a433eca192a78bc8c9edda12eedd73e /profcollectd
parent24816976147132a46972bb6a0e3bc36628a9c612 (diff)
downloadextras-f769e5c401c2a7db50c9df57f960a9a70bb8476e.tar.gz
profcollectd: Don't exit if no trace provider is found
We need profcollectd to idle and ignore all requests in such case, so that the event forwarding service won't need to constantly trying to connect to it. Bug: 79161490 Test: build Change-Id: Id60baa6c975d1d580f227ef44a3d9b502b844847
Diffstat (limited to 'profcollectd')
-rw-r--r--profcollectd/libprofcollectd/scheduler.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/profcollectd/libprofcollectd/scheduler.cpp b/profcollectd/libprofcollectd/scheduler.cpp
index 4c1fa302..eb47d843 100644
--- a/profcollectd/libprofcollectd/scheduler.cpp
+++ b/profcollectd/libprofcollectd/scheduler.cpp
@@ -98,10 +98,8 @@ ProfcollectdScheduler::ProfcollectdScheduler() {
// Load a registered hardware trace provider.
if ((hwtracer = REGISTER_SIMPLEPERF_ETM_PROVIDER())) {
LOG(INFO) << "ETM provider registered.";
- return;
} else {
LOG(ERROR) << "No hardware trace provider found for this architecture.";
- exit(EXIT_FAILURE);
}
}
@@ -156,6 +154,10 @@ OptError ProfcollectdScheduler::TerminateCollection() {
}
OptError ProfcollectdScheduler::TraceOnce(const std::string& tag) {
+ if(!hwtracer) {
+ return "No trace provider registered.";
+ }
+
const std::lock_guard<std::mutex> lock(mu);
bool success = hwtracer->Trace(config.traceOutputDir, tag, config.samplingPeriod);
if (!success) {
@@ -166,6 +168,10 @@ OptError ProfcollectdScheduler::TraceOnce(const std::string& tag) {
}
OptError ProfcollectdScheduler::ProcessProfile() {
+ if(!hwtracer) {
+ return "No trace provider registered.";
+ }
+
const std::lock_guard<std::mutex> lock(mu);
hwtracer->Process(config.traceOutputDir, config.profileOutputDir, config.binaryFilter);
std::vector<fs::path> profiles;