Loading system/common/metrics.cc +10 −0 Original line number Diff line number Diff line Loading @@ -597,6 +597,16 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, } } void LogHciTimeoutEvent(uint32_t hci_cmd) { int ret = android::util::stats_write(android::util::BLUETOOTH_HCI_TIMEOUT_REPORTED, static_cast<int64_t>(hci_cmd)); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for opcode " << loghex(hci_cmd) << ", error " << ret; } } } // namespace common } // namespace bluetooth system/common/metrics.h +8 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,14 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, uint32_t hci_event, uint32_t hci_ble_event, uint32_t cmd_status, uint32_t reason_code); /** * Logs when Bluetooth controller failed to reply with command status within * a timeout period after receiving an HCI command from the host * * @param hci_cmd opcode of HCI command that caused this timeout */ void LogHciTimeoutEvent(uint32_t hci_cmd); } // namespace common } // namespace bluetooth system/hci/src/hci_layer.cc +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <base/run_loop.h> #include <base/sequenced_task_runner.h> #include <base/threading/thread.h> #include <frameworks/base/core/proto/android/bluetooth/hci/enums.pb.h> #include <signal.h> #include <string.h> Loading @@ -38,6 +39,7 @@ #include "btsnoop.h" #include "buffer_allocator.h" #include "common/message_loop_thread.h" #include "common/metrics.h" #include "hci_inject.h" #include "hci_internals.h" #include "hcidefs.h" Loading Loading @@ -481,6 +483,7 @@ static void command_timed_out_log_info(void* original_wait_entry) { } LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); bluetooth::common::LogHciTimeoutEvent(wait_entry->opcode); } } Loading @@ -493,6 +496,7 @@ static void command_timed_out(void* original_wait_entry) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); bluetooth::common::LogHciTimeoutEvent(android::bluetooth::hci::CMD_UNKNOWN); } else { command_timed_out_log_info(original_wait_entry); lock.unlock(); Loading Loading
system/common/metrics.cc +10 −0 Original line number Diff line number Diff line Loading @@ -597,6 +597,16 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, } } void LogHciTimeoutEvent(uint32_t hci_cmd) { int ret = android::util::stats_write(android::util::BLUETOOTH_HCI_TIMEOUT_REPORTED, static_cast<int64_t>(hci_cmd)); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for opcode " << loghex(hci_cmd) << ", error " << ret; } } } // namespace common } // namespace bluetooth
system/common/metrics.h +8 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,14 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, uint32_t hci_event, uint32_t hci_ble_event, uint32_t cmd_status, uint32_t reason_code); /** * Logs when Bluetooth controller failed to reply with command status within * a timeout period after receiving an HCI command from the host * * @param hci_cmd opcode of HCI command that caused this timeout */ void LogHciTimeoutEvent(uint32_t hci_cmd); } // namespace common } // namespace bluetooth
system/hci/src/hci_layer.cc +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <base/run_loop.h> #include <base/sequenced_task_runner.h> #include <base/threading/thread.h> #include <frameworks/base/core/proto/android/bluetooth/hci/enums.pb.h> #include <signal.h> #include <string.h> Loading @@ -38,6 +39,7 @@ #include "btsnoop.h" #include "buffer_allocator.h" #include "common/message_loop_thread.h" #include "common/metrics.h" #include "hci_inject.h" #include "hci_internals.h" #include "hcidefs.h" Loading Loading @@ -481,6 +483,7 @@ static void command_timed_out_log_info(void* original_wait_entry) { } LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); bluetooth::common::LogHciTimeoutEvent(wait_entry->opcode); } } Loading @@ -493,6 +496,7 @@ static void command_timed_out(void* original_wait_entry) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); bluetooth::common::LogHciTimeoutEvent(android::bluetooth::hci::CMD_UNKNOWN); } else { command_timed_out_log_info(original_wait_entry); lock.unlock(); Loading