diff options
author | Andreas Gampe <agampe@google.com> | 2018-01-18 14:30:58 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2018-01-18 14:48:17 -0800 |
commit | d2c99752e774c73f28cf0cef4cdf902e3b5e4781 (patch) | |
tree | b1aac4485c1b6d710b6a203aeb94452fcf7e8f72 | |
parent | bc0c17b7ce9332f18862cf20535eaf010b7fd37b (diff) | |
download | extras-d2c99752e774c73f28cf0cef4cdf902e3b5e4781.tar.gz |
Perfprofd: Remove ConfigReader from binder interface
Remove reliance on ConfigReader for defaults.
Test: mmma system/extras/perfprofd
Change-Id: If580d30044a4ff2e1206b8ad2529f7dd9889292a
-rw-r--r-- | perfprofd/binder_interface/perfprofd_binder.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/perfprofd/binder_interface/perfprofd_binder.cc b/perfprofd/binder_interface/perfprofd_binder.cc index 808c365d..34d6a038 100644 --- a/perfprofd/binder_interface/perfprofd_binder.cc +++ b/perfprofd/binder_interface/perfprofd_binder.cc @@ -45,7 +45,6 @@ #include "perf_profile.pb.h" #include "config.h" -#include "configreader.h" #include "perfprofdcore.h" namespace android { @@ -85,6 +84,15 @@ class BinderConfig : public Config { return true; } + // Operator= to simplify setting the config values. This will retain the + // original mutex, condition-variable etc. + BinderConfig& operator=(const BinderConfig& rhs) { + // Copy base fields. + *static_cast<Config*>(this) = static_cast<const Config&>(rhs); + + return *this; + } + private: std::mutex mutex_; std::condition_variable cv_; @@ -180,8 +188,8 @@ status_t PerfProfdNativeService::dump(int fd, const Vector<String16> &args) { Status PerfProfdNativeService::startProfiling(int32_t profilingDuration, int32_t profilingInterval, int32_t iterations) { - auto config_fn = [&](Config& config) { - ConfigReader().FillConfig(&config); // Create a default config. + auto config_fn = [&](BinderConfig& config) { + config = BinderConfig(); // Reset to a default config. config.sample_duration_in_s = static_cast<uint32_t>(profilingDuration); config.collection_interval_in_s = static_cast<uint32_t>(profilingInterval); @@ -229,8 +237,8 @@ Status PerfProfdNativeService::StartProfilingProtobuf(ProtoLoaderFn fn) { if (!fn(proto_config)) { return binder::Status::fromExceptionCode(2); } - auto config_fn = [&proto_config](Config& config) { - ConfigReader().FillConfig(&config); // Create a default config. + auto config_fn = [&proto_config](BinderConfig& config) { + config = BinderConfig(); // Reset to a default config. // Copy proto values. #define CHECK_AND_COPY_FROM_PROTO(name) \ |