telemetry_log.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_DIAGNOSTICS_TELEMETRY_LOG_H_
  5. #define ASH_SYSTEM_DIAGNOSTICS_TELEMETRY_LOG_H_
  6. #include <string>
  7. #include "ash/ash_export.h"
  8. #include "ash/webui/diagnostics_ui/mojom/system_data_provider.mojom.h"
  9. namespace ash {
  10. namespace diagnostics {
  11. class ASH_EXPORT TelemetryLog {
  12. public:
  13. TelemetryLog();
  14. ~TelemetryLog();
  15. TelemetryLog(const TelemetryLog&) = delete;
  16. TelemetryLog& operator=(const TelemetryLog&) = delete;
  17. void UpdateSystemInfo(mojom::SystemInfoPtr latest_system_info);
  18. void UpdateBatteryChargeStatus(
  19. mojom::BatteryChargeStatusPtr latest_battery_charge_status);
  20. void UpdateBatteryHealth(mojom::BatteryHealthPtr latest_battery_health);
  21. void UpdateMemoryUsage(mojom::MemoryUsagePtr latest_memory_usage);
  22. void UpdateCpuUsage(mojom::CpuUsagePtr latest_cpu_usage);
  23. // Returns the telemetry log as a string.
  24. std::string GetContents() const;
  25. private:
  26. mojom::SystemInfoPtr latest_system_info_;
  27. mojom::BatteryChargeStatusPtr latest_battery_charge_status_;
  28. mojom::BatteryHealthPtr latest_battery_health_;
  29. mojom::MemoryUsagePtr latest_memory_usage_;
  30. mojom::CpuUsagePtr latest_cpu_usage_;
  31. };
  32. } // namespace diagnostics
  33. } // namespace ash
  34. #endif // ASH_SYSTEM_DIAGNOSTICS_TELEMETRY_LOG_H_