Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: chromeos/dbus/debug_daemon_client.cc

Issue 1218583002: metrics: Add dbus interface for GetRandomPerfOutput (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create a scoped_ptr<TestIncognitoObserver> and return as scoped_ptr<WindowedIncognitoObserver> Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/debug_daemon_client.cc
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc
index 59e98405b866f82255ae0e6953d0cdcbd4c13640..ea60a492d2385567d9166875c5ac301af5ff86d4 100644
--- a/chromeos/dbus/debug_daemon_client.cc
+++ b/chromeos/dbus/debug_daemon_client.cc
@@ -161,6 +161,19 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
callback));
}
+ void GetPerfOutput(uint32_t duration,
+ const GetPerfOutputCallback& callback) override {
+ dbus::MethodCall method_call(debugd::kDebugdInterface,
+ debugd::kGetRandomPerfOutput);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendUint32(duration);
+
+ debugdaemon_proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&DebugDaemonClientImpl::OnGetPerfOutput,
+ weak_ptr_factory_.GetWeakPtr(), callback));
+ }
+
void GetScrubbedLogs(const GetLogsCallback& callback) override {
dbus::MethodCall method_call(debugd::kDebugdInterface,
debugd::kGetFeedbackLogs);
@@ -461,6 +474,36 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
callback.Run(data);
}
+ void OnGetPerfOutput(const GetPerfOutputCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ return;
+ }
stevenjb 2015/07/07 02:03:51 nit: no {}
Simon Que 2015/07/07 04:39:46 Done.
+
+ dbus::MessageReader reader(response);
+
+ int status = 0;
+ if (!reader.PopInt32(&status))
+ return;
+
+ const uint8* buffer = NULL;
stevenjb 2015/07/07 02:03:51 nullptr
Simon Que 2015/07/07 04:39:46 Done.
+ size_t buf_size = 0;
+
+ if (!reader.PopArrayOfBytes(&buffer, &buf_size))
+ return;
+ std::vector<uint8> perf_data;
+ if (buf_size > 0)
+ perf_data.insert(perf_data.end(), buffer, buffer + buf_size);
+
+ if (!reader.PopArrayOfBytes(&buffer, &buf_size))
+ return;
+ std::vector<uint8> perf_stat;
+ if (buf_size > 0)
+ perf_stat.insert(perf_stat.end(), buffer, buffer + buf_size);
+
+ callback.Run(status, perf_data, perf_stat);
+ }
+
void OnGetAllLogs(const GetLogsCallback& callback,
dbus::Response* response) {
std::map<std::string, std::string> logs;

Powered by Google App Engine
This is Rietveld 408576698