histogram_util.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2022 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_COMPONENTS_FWUPD_HISTOGRAM_UTIL_H_
  5. #define ASH_COMPONENTS_FWUPD_HISTOGRAM_UTIL_H_
  6. #include <cstdint>
  7. #include <string>
  8. namespace ash {
  9. namespace firmware_update {
  10. namespace metrics {
  11. // The enums below are used in histograms, do not remove/renumber entries. If
  12. // you're adding to any of these enums, update the corresponding enum listing in
  13. // tools/metrics/histograms/enums.xml: FirmwareUpdateInstallResult.
  14. enum class FirmwareUpdateInstallResult {
  15. kSuccess = 0,
  16. kInstallFailed = 1,
  17. kFailedToCreateUpdateDirectory = 2,
  18. kInvalidDestinationFile = 3,
  19. kInvalidFileDescriptor = 4,
  20. kFailedToDownloadToFile = 5,
  21. kMaxValue = kFailedToDownloadToFile,
  22. };
  23. void EmitDeviceCount(int num_devices, bool is_startup);
  24. void EmitUpdateCount(int num_updates,
  25. int num_critical_updates,
  26. bool is_startup);
  27. void EmitInstallResult(FirmwareUpdateInstallResult result);
  28. std::string GetSourceStr(bool is_startup);
  29. } // namespace metrics
  30. } // namespace firmware_update
  31. } // namespace ash
  32. #endif // ASH_COMPONENTS_FWUPD_HISTOGRAM_UTIL_H_