summaryrefslogtreecommitdiff
path: root/perfprofd/perfprofdmain.cc
diff options
context:
space:
mode:
Diffstat (limited to 'perfprofd/perfprofdmain.cc')
-rw-r--r--perfprofd/perfprofdmain.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/perfprofd/perfprofdmain.cc b/perfprofd/perfprofdmain.cc
index 64dfad79..403e0253 100644
--- a/perfprofd/perfprofdmain.cc
+++ b/perfprofd/perfprofdmain.cc
@@ -17,8 +17,11 @@
#include <string.h>
+#include <android-base/logging.h>
+
#include "config.h"
#include "perfprofd_binder.h"
+#include "perfprofdcore.h"
extern int perfprofd_main(int argc, char** argv, Config* config);
@@ -32,6 +35,24 @@ int main(int argc, char** argv)
void Sleep(size_t seconds) override {
sleep(seconds);
}
+ bool IsProfilingEnabled() const override {
+ //
+ // Check for existence of semaphore file in config directory
+ //
+ if (access(config_directory.c_str(), F_OK) == -1) {
+ PLOG(WARNING) << "unable to open config directory " << config_directory;
+ return false;
+ }
+
+ // Check for existence of semaphore file
+ std::string semaphore_filepath = config_directory
+ + "/" + SEMAPHORE_FILENAME;
+ if (access(semaphore_filepath.c_str(), F_OK) == -1) {
+ return false;
+ }
+
+ return true;
+ }
};
PosixSleepConfig config;
return perfprofd_main(argc, argv, &config);