| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
| 13 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
| 14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/dbus/dbus_client.h" | 15 #include "chromeos/dbus/dbus_client.h" |
| 16 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 17 | 17 |
| 18 namespace metrics { | |
| 19 class PerfDataProto; | |
| 20 } | |
| 21 | |
| 22 namespace chromeos { | 18 namespace chromeos { |
| 23 | 19 |
| 24 // DebugDaemonClient is used to communicate with the debug daemon. | 20 // DebugDaemonClient is used to communicate with the debug daemon. |
| 25 class CHROMEOS_EXPORT DebugDaemonClient : public DBusClient { | 21 class CHROMEOS_EXPORT DebugDaemonClient : public DBusClient { |
| 26 public: | 22 public: |
| 27 ~DebugDaemonClient() override; | 23 ~DebugDaemonClient() override; |
| 28 | 24 |
| 29 // Called once GetDebugLogs() is complete. Takes one parameter: | 25 // Called once GetDebugLogs() is complete. Takes one parameter: |
| 30 // - succeeded: was the logs stored successfully. | 26 // - succeeded: was the logs stored successfully. |
| 31 typedef base::Callback<void(bool succeeded)> GetDebugLogsCallback; | 27 typedef base::Callback<void(bool succeeded)> GetDebugLogsCallback; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Gets information about network interfaces as json. | 82 // Gets information about network interfaces as json. |
| 87 virtual void GetNetworkInterfaces( | 83 virtual void GetNetworkInterfaces( |
| 88 const GetNetworkInterfacesCallback& callback) = 0; | 84 const GetNetworkInterfacesCallback& callback) = 0; |
| 89 | 85 |
| 90 // Called once GetPerfData() is complete only if the the data is successfully | 86 // Called once GetPerfData() is complete only if the the data is successfully |
| 91 // obtained from debugd. | 87 // obtained from debugd. |
| 92 typedef base::Callback<void(const std::vector<uint8>& data)> | 88 typedef base::Callback<void(const std::vector<uint8>& data)> |
| 93 GetPerfDataCallback; | 89 GetPerfDataCallback; |
| 94 | 90 |
| 95 // Runs perf for |duration| seconds and returns data collected. | 91 // Runs perf for |duration| seconds and returns data collected. |
| 92 // TODO(sque): This is being replaced by GetPerfOutput(). Remove this function |
| 93 // and the above callback typedef when the new function is running. |
| 96 virtual void GetPerfData(uint32_t duration, | 94 virtual void GetPerfData(uint32_t duration, |
| 97 const GetPerfDataCallback& callback) = 0; | 95 const GetPerfDataCallback& callback) = 0; |
| 98 | 96 |
| 97 // Called once GetPerfOutput() is complete only if the the data is |
| 98 // successfully obtained from debugd. |
| 99 // Arguments: |
| 100 // - The status from running perf. |
| 101 // - Output from "perf record", in PerfDataProto format. |
| 102 // - Output from "perf stat", in PerfStatProto format. |
| 103 using GetPerfOutputCallback = |
| 104 base::Callback<void(int status, |
| 105 const std::vector<uint8>& perf_data, |
| 106 const std::vector<uint8>& perf_stat)>; |
| 107 |
| 108 // Runs perf for |duration| seconds and returns data collected. |
| 109 virtual void GetPerfOutput(uint32_t duration, |
| 110 const GetPerfOutputCallback& callback) = 0; |
| 111 |
| 99 // Callback type for GetScrubbedLogs(), GetAllLogs() or GetUserLogFiles(). | 112 // Callback type for GetScrubbedLogs(), GetAllLogs() or GetUserLogFiles(). |
| 100 typedef base::Callback<void(bool succeeded, | 113 typedef base::Callback<void(bool succeeded, |
| 101 const std::map<std::string, std::string>& logs)> | 114 const std::map<std::string, std::string>& logs)> |
| 102 GetLogsCallback; | 115 GetLogsCallback; |
| 103 | 116 |
| 104 // Gets scrubbed logs from debugd. | 117 // Gets scrubbed logs from debugd. |
| 105 virtual void GetScrubbedLogs(const GetLogsCallback& callback) = 0; | 118 virtual void GetScrubbedLogs(const GetLogsCallback& callback) = 0; |
| 106 | 119 |
| 107 // Gets all logs collected by debugd. | 120 // Gets all logs collected by debugd. |
| 108 virtual void GetAllLogs(const GetLogsCallback& callback) = 0; | 121 virtual void GetAllLogs(const GetLogsCallback& callback) = 0; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Create() should be used instead. | 209 // Create() should be used instead. |
| 197 DebugDaemonClient(); | 210 DebugDaemonClient(); |
| 198 | 211 |
| 199 private: | 212 private: |
| 200 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); | 213 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); |
| 201 }; | 214 }; |
| 202 | 215 |
| 203 } // namespace chromeos | 216 } // namespace chromeos |
| 204 | 217 |
| 205 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 218 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| OLD | NEW |