diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-04-26 21:10:44 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-26 21:10:44 +0000 |
commit | 0148e814b68918f8637efedc727a2adafa10e6ee (patch) | |
tree | f225d2fea29cd1b5119bab94b70471e97cd893b9 | |
parent | b849b1878c8e5137ff67a40856daa0eaa8fa5c4d (diff) | |
parent | 529af96ba77f26c1597d077ca55d051feeb5df3d (diff) | |
download | extras-android-n-iot-release-lg-thinq-wk7.tar.gz |
Merge changes I4e15cd4f,I896cfe8c,I5d80887aandroid-n-iot-release-lg-thinq-wk7
* changes:
Perfprofd: Add ScopeGuard for file deletion
Perfprofd: Fix binder interface
Perfprofd: Use the right parameter
-rw-r--r-- | perfprofd/binder_interface/perfprofd_binder.cc | 3 | ||||
-rw-r--r-- | perfprofd/perfprofdcore.cc | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/perfprofd/binder_interface/perfprofd_binder.cc b/perfprofd/binder_interface/perfprofd_binder.cc index cbb3fcef..e3f66eab 100644 --- a/perfprofd/binder_interface/perfprofd_binder.cc +++ b/perfprofd/binder_interface/perfprofd_binder.cc @@ -337,7 +337,8 @@ status_t PerfProfdNativeService::onTransact(uint32_t _aidl_code, } default: - return BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags); + return ::android::os::BnPerfProfd::onTransact( + _aidl_code, _aidl_data, _aidl_reply, _aidl_flags); } } diff --git a/perfprofd/perfprofdcore.cc b/perfprofd/perfprofdcore.cc index d7b0e9b4..c5605ac7 100644 --- a/perfprofd/perfprofdcore.cc +++ b/perfprofd/perfprofdcore.cc @@ -36,6 +36,7 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/macros.h> +#include <android-base/scopeguard.h> #include <android-base/stringprintf.h> #ifdef __BIONIC__ @@ -456,7 +457,6 @@ PROFILE_RESULT encode_to_proto(const std::string &data_file_path, // static PROFILE_RESULT invoke_perf(Config& config, const std::string &perf_path, - unsigned sampling_period, const char *stack_profile_opt, unsigned duration, const std::string &data_file_path, @@ -495,11 +495,11 @@ static PROFILE_RESULT invoke_perf(Config& config, std::string p_str; if (config.sampling_frequency > 0) { argv[slot++] = "-f"; - p_str = android::base::StringPrintf("%u", sampling_period); + p_str = android::base::StringPrintf("%u", config.sampling_frequency); argv[slot++] = p_str.c_str(); } else if (config.sampling_period > 0) { argv[slot++] = "-c"; - p_str = android::base::StringPrintf("%u", sampling_period); + p_str = android::base::StringPrintf("%u", config.sampling_period); argv[slot++] = p_str.c_str(); } @@ -651,17 +651,18 @@ static ProtoUniquePtr collect_profile(Config& config) bool take_action = (hardwire && duration <= max_duration); HardwireCpuHelper helper(take_action); + auto scope_guard = android::base::make_scope_guard( + [&data_file_path]() { unlink(data_file_path.c_str()); }); + // // Invoke perf // const char *stack_profile_opt = (config.stack_profile ? "-g" : nullptr); const std::string& perf_path = config.perf_path; - uint32_t period = config.sampling_period; PROFILE_RESULT ret = invoke_perf(config, perf_path.c_str(), - period, stack_profile_opt, duration, data_file_path, |