Loading system/gd/metrics/chromeos/metrics.cc +19 −0 Original line number Diff line number Diff line Loading @@ -318,5 +318,24 @@ void LogMetricsChipsetInfoReport() { } } void LogMetricsSuspendIdState(uint32_t state) { int64_t suspend_id_state = 0; int64_t boot_time; std::string boot_id; if (!GetBootId(&boot_id)) return; boot_time = bluetooth::common::time_get_os_boottime_us(); suspend_id_state = (int64_t)ToSuspendIdState(state); LOG_DEBUG("SuspendIdState: %s, %d, %d", boot_id.c_str(), boot_time, suspend_id_state); ::metrics::structured::events::bluetooth::BluetoothSuspendIdStateChanged() .SetBootId(boot_id) .SetSystemTime(boot_time) .SetSuspendIdState(suspend_id_state) .Record(); } } // namespace metrics } // namespace bluetooth system/gd/metrics/chromeos/metrics_event.cc +4 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,10 @@ AdapterState ToAdapterState(uint32_t state) { return state == 1 ? AdapterState::ON : AdapterState::OFF; } SuspendIdState ToSuspendIdState(uint32_t state) { return state == 1 ? SuspendIdState::Recorded : SuspendIdState::NoRecord; } ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type) { // A map stores the pending ConnectionType used to match a pairing event with unknown type. // map<address, type> Loading system/gd/metrics/chromeos/metrics_event.h +7 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,10 @@ enum class MetricTransportType { TRANSPORT_TYPE_SDIO = 3, }; // ENUM definition for suspend id state that in sync with ChromeOS structured metrics // BluetoothSuspendIdStateChanged/SuspendIdState. enum class SuspendIdState : int64_t { NoRecord = 0, Recorded = 1 }; // A struct holds the parsed profile connection event. struct ProfileConnectionEvent { int64_t type; Loading @@ -205,6 +209,9 @@ struct ProfileConnectionEvent { // Convert topshim::btif::BtState to AdapterState. AdapterState ToAdapterState(uint32_t state); // Convert to SuspendIdState. SuspendIdState ToSuspendIdState(uint32_t state); // Convert topshim::btif::BtDeviceType to ConnectionType ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type); Loading system/gd/metrics/linux/metrics.cc +2 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,7 @@ void LogMetricsAclConnectionStateChanged( void LogMetricsChipsetInfoReport() {} void LogMetricsSuspendIdState(uint32_t state){}; } // namespace metrics } // namespace bluetooth system/gd/metrics/metrics.h +2 −0 Original line number Diff line number Diff line Loading @@ -40,5 +40,7 @@ void LogMetricsAclConnectionStateChanged( RawAddress* addr, uint32_t transport, uint32_t status, uint32_t acl_state, uint32_t direction, uint32_t hci_reason); void LogMetricsChipsetInfoReport(); void LogMetricsSuspendIdState(uint32_t state); } // namespace metrics } // namespace bluetooth Loading
system/gd/metrics/chromeos/metrics.cc +19 −0 Original line number Diff line number Diff line Loading @@ -318,5 +318,24 @@ void LogMetricsChipsetInfoReport() { } } void LogMetricsSuspendIdState(uint32_t state) { int64_t suspend_id_state = 0; int64_t boot_time; std::string boot_id; if (!GetBootId(&boot_id)) return; boot_time = bluetooth::common::time_get_os_boottime_us(); suspend_id_state = (int64_t)ToSuspendIdState(state); LOG_DEBUG("SuspendIdState: %s, %d, %d", boot_id.c_str(), boot_time, suspend_id_state); ::metrics::structured::events::bluetooth::BluetoothSuspendIdStateChanged() .SetBootId(boot_id) .SetSystemTime(boot_time) .SetSuspendIdState(suspend_id_state) .Record(); } } // namespace metrics } // namespace bluetooth
system/gd/metrics/chromeos/metrics_event.cc +4 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,10 @@ AdapterState ToAdapterState(uint32_t state) { return state == 1 ? AdapterState::ON : AdapterState::OFF; } SuspendIdState ToSuspendIdState(uint32_t state) { return state == 1 ? SuspendIdState::Recorded : SuspendIdState::NoRecord; } ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type) { // A map stores the pending ConnectionType used to match a pairing event with unknown type. // map<address, type> Loading
system/gd/metrics/chromeos/metrics_event.h +7 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,10 @@ enum class MetricTransportType { TRANSPORT_TYPE_SDIO = 3, }; // ENUM definition for suspend id state that in sync with ChromeOS structured metrics // BluetoothSuspendIdStateChanged/SuspendIdState. enum class SuspendIdState : int64_t { NoRecord = 0, Recorded = 1 }; // A struct holds the parsed profile connection event. struct ProfileConnectionEvent { int64_t type; Loading @@ -205,6 +209,9 @@ struct ProfileConnectionEvent { // Convert topshim::btif::BtState to AdapterState. AdapterState ToAdapterState(uint32_t state); // Convert to SuspendIdState. SuspendIdState ToSuspendIdState(uint32_t state); // Convert topshim::btif::BtDeviceType to ConnectionType ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type); Loading
system/gd/metrics/linux/metrics.cc +2 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,7 @@ void LogMetricsAclConnectionStateChanged( void LogMetricsChipsetInfoReport() {} void LogMetricsSuspendIdState(uint32_t state){}; } // namespace metrics } // namespace bluetooth
system/gd/metrics/metrics.h +2 −0 Original line number Diff line number Diff line Loading @@ -40,5 +40,7 @@ void LogMetricsAclConnectionStateChanged( RawAddress* addr, uint32_t transport, uint32_t status, uint32_t acl_state, uint32_t direction, uint32_t hci_reason); void LogMetricsChipsetInfoReport(); void LogMetricsSuspendIdState(uint32_t state); } // namespace metrics } // namespace bluetooth