summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perfprofd/binder_interface/perfprofd_binder.cc3
-rw-r--r--perfprofd/perfprofdcore.cc11
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,