bluetooth_metrics_helper.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_METRICS_HELPER_H_
  5. #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_METRICS_HELPER_H_
  6. #include "base/time/time.h"
  7. namespace dbus {
  8. class ErrorResponse;
  9. }
  10. namespace bluez {
  11. // These metrics are defined under
  12. // tools/metrics/histograms/metadata/bluetooth/histogramx.xml.
  13. constexpr char kLatencyMetric[] = "Bluetooth.BlueZ.DBus.%s.Latency";
  14. constexpr char kResultMetric[] = "Bluetooth.BlueZ.DBus.%s.Result";
  15. // Any new methods must be defined in the 'BlueZDBusMethodName' variant set in
  16. // tools/metrics/histograms/metadata/bluetooth/histograms.xml.
  17. constexpr char kConnectDeviceMethod[] = "ConnectDevice";
  18. constexpr char kRegisterProfileMethod[] = "RegisterProfile";
  19. constexpr char kUnregisterProfileMethod[] = "UnregisterProfile";
  20. constexpr char kDisconnectProfileMethod[] = "DisconnectProfile";
  21. constexpr char kGetServiceRecordsMethod[] = "GetServiceRecords";
  22. void RecordSuccess(const std::string& method_name, base::Time start_time);
  23. void RecordFailure(const std::string& method_name,
  24. dbus::ErrorResponse* response);
  25. } // namespace bluez
  26. #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_METRICS_HELPER_H_