Loading system/audio_hal_interface/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ cc_test { static_libs: [ "libbt-audio-hal-interface", "libbt-common", "libbt-stack", ], cflags: [ "-DBUILDCFG", Loading system/audio_hal_interface/client_interface.cc +0 −16 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <hidl/ServiceManagement.h> #include <future> #include "btu.h" #include "osi/include/log.h" namespace bluetooth { Loading Loading @@ -75,8 +74,6 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { : sink_(sink), provider_(provider){}; Return<void> startStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BluetoothAudioCtrlAck ack = sink_->StartRequest(); if (ack != BluetoothAudioCtrlAck::PENDING) { auto hidl_retval = Loading @@ -85,13 +82,10 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description(); } } main_thread_hwbinder_timer_stop(); return Void(); } Return<void> suspendStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BluetoothAudioCtrlAck ack = sink_->SuspendRequest(); if (ack != BluetoothAudioCtrlAck::PENDING) { auto hidl_retval = Loading @@ -100,22 +94,16 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description(); } } main_thread_hwbinder_timer_stop(); return Void(); } Return<void> stopStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); sink_->StopRequest(); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> getPresentationPosition( getPresentationPosition_cb _hidl_cb) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); uint64_t remote_delay_report_ns; uint64_t total_bytes_read; timespec data_position; Loading @@ -138,13 +126,10 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { : BluetoothAudioStatus::FAILURE), remote_delay_report_ns, total_bytes_read, transmittedOctetsTimeStamp); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> updateMetadata(const SourceMetadata& sourceMetadata) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); LOG(INFO) << __func__ << ": " << sourceMetadata.tracks.size() << " track(s)"; // refer to StreamOut.impl.h within Audio HAL (AUDIO_HAL_VERSION_5_0) Loading @@ -161,7 +146,6 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { const source_metadata_t source_metadata = { .track_count = metadata_vec.size(), .tracks = metadata_vec.data()}; sink_->MetadataChanged(source_metadata); main_thread_hwbinder_timer_stop(); return Void(); } Loading system/btif/src/bluetooth.cc +0 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ #include "osi/include/osi.h" #include "osi/include/wakelock.h" #include "stack/gatt/connection_manager.h" #include "stack/include/btu.h" #include "stack_manager.h" using bluetooth::hearing_aid::HearingAidInterface; Loading Loading @@ -320,7 +319,6 @@ static void dump(int fd, const char** arguments) { btif_debug_av_dump(fd); bta_debug_av_dump(fd); stack_debug_avdtp_api_dump(fd); stack_debug_hwbinder_thread_dump(fd); bluetooth::avrcp::AvrcpService::DebugDump(fd); btif_debug_config_dump(fd); BTA_HfClientDumpStatistics(fd); Loading system/hci/src/hci_layer_android.cc +0 −15 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <base/location.h> #include <base/logging.h> #include "btu.h" #include "buffer_allocator.h" #include "osi/include/log.h" Loading Loading @@ -90,46 +89,32 @@ class BluetoothHciCallbacks : public V1_1::IBluetoothHciCallbacks { } Return<void> initializationComplete(Status status) override { // Do not fire the hwbinder timer here because the main thread is blocked // before the initialization is completed. CHECK(status == Status::SUCCESS); initialization_complete(); return Void(); } Return<void> hciEventReceived(const hidl_vec<uint8_t>& event) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_EVT, event); hci_event_received(FROM_HERE, packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> aclDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_ACL, data); acl_event_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> scoDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_SCO, data); sco_data_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> isoDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_ISO, data); iso_data_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Loading system/stack/btu/btu_task.cc +0 −95 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ #include "bte.h" #include "btif/include/btif_common.h" #include "common/message_loop_thread.h" #include "common/once_timer.h" #include "common/time_util.h" #include "osi/include/osi.h" #include "stack/btm/btm_int.h" #include "stack/include/btu.h" Loading @@ -40,51 +38,12 @@ #include <base/run_loop.h> #include <base/threading/thread.h> #ifndef HWBINDER_TIMEOUT_MS #define HWBINDER_TIMEOUT_MS 500 #endif using bluetooth::common::MessageLoopThread; using bluetooth::common::OnceTimer; /* Define utils for HwBinder timer dumpsys */ typedef struct { uint64_t counter_5ms = 0; uint64_t counter_20ms = 0; uint64_t counter_50ms = 0; uint64_t counter_100ms = 0; uint64_t counter_250ms = 0; uint64_t counter_max_ms = 0; void addTime(uint64_t time) { if (time < 5) { counter_5ms++; } else if (time < 20) { counter_20ms++; } else if (time < 50) { counter_50ms++; } else if (time < 100) { counter_100ms++; } else if (time < 250) { counter_250ms++; } else { counter_max_ms++; } } } hwbinder_timer_collector_t; typedef struct { uint64_t start_time_ms; std::string from_here; } hwbinder_timestamp_t; std::map<std::string, hwbinder_timer_collector_t> timer_map; hwbinder_timestamp_t hwbinder_timestamp; /* Define BTU storage area */ uint8_t btu_trace_level = HCI_INITIAL_TRACE_LEVEL; static MessageLoopThread main_thread("bt_main_thread"); static OnceTimer hwbinder_timer; void btu_hci_msg_process(BT_HDR* p_msg) { /* Determine the input message type. */ Loading Loading @@ -138,60 +97,6 @@ bt_status_t do_in_main_thread(const base::Location& from_here, return BT_STATUS_SUCCESS; } void hwbinder_timeout(const base::Location& from_here) { LOG(FATAL) << "HwBinder thread timeout at " << from_here.ToString(); } void main_thread_hwbinder_timer_start(const base::Location& from_here) { if (hwbinder_timer.IsScheduled()) { LOG(FATAL) << __func__ << ": hwbinder_timer is already scheduled!"; } if (!hwbinder_timer.Schedule( main_thread.GetWeakPtr(), from_here, base::Bind(&hwbinder_timeout, from_here), base::TimeDelta::FromMilliseconds(HWBINDER_TIMEOUT_MS))) { LOG(FATAL) << __func__ << ": failed from " << from_here.ToString(); } hwbinder_timestamp.start_time_ms = bluetooth::common::time_get_os_boottime_ms(); hwbinder_timestamp.from_here = from_here.ToString(); } void main_thread_hwbinder_timer_stop() { if (!hwbinder_timer.IsScheduled()) { LOG(FATAL) << __func__ << ": hwbinder_timer is not scheduled!"; } hwbinder_timer.CancelAndWait(); uint64_t delta_time = bluetooth::common::time_get_os_boottime_ms() - hwbinder_timestamp.start_time_ms; auto it = timer_map.find(hwbinder_timestamp.from_here); if (it == timer_map.end()) { hwbinder_timer_collector_t collector; collector.addTime(delta_time); timer_map.emplace(hwbinder_timestamp.from_here, collector); } else { it->second.addTime(delta_time); } } void stack_debug_hwbinder_thread_dump(int fd) { dprintf(fd, "\nHwBinder Thread Timer:\n"); for (auto it = timer_map.begin(); it != timer_map.end(); it++) { dprintf(fd, " %s:\n", it->first.c_str()); std::stringstream ss; ss << " Invoke Counts (5ms/20ms/50ms/100ms/250ms/Over 250ms) : " << std::to_string(it->second.counter_5ms) << " / " << std::to_string(it->second.counter_20ms) << " / " << std::to_string(it->second.counter_50ms) << " / " << std::to_string(it->second.counter_100ms) << " / " << std::to_string(it->second.counter_250ms) << " / " << std::to_string(it->second.counter_max_ms); dprintf(fd, "%s\n", ss.str().c_str()); } } void btu_task_start_up(UNUSED_ATTR void* context) { LOG(INFO) << "Bluetooth chip preload is complete"; Loading Loading
system/audio_hal_interface/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ cc_test { static_libs: [ "libbt-audio-hal-interface", "libbt-common", "libbt-stack", ], cflags: [ "-DBUILDCFG", Loading
system/audio_hal_interface/client_interface.cc +0 −16 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <hidl/ServiceManagement.h> #include <future> #include "btu.h" #include "osi/include/log.h" namespace bluetooth { Loading Loading @@ -75,8 +74,6 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { : sink_(sink), provider_(provider){}; Return<void> startStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BluetoothAudioCtrlAck ack = sink_->StartRequest(); if (ack != BluetoothAudioCtrlAck::PENDING) { auto hidl_retval = Loading @@ -85,13 +82,10 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description(); } } main_thread_hwbinder_timer_stop(); return Void(); } Return<void> suspendStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BluetoothAudioCtrlAck ack = sink_->SuspendRequest(); if (ack != BluetoothAudioCtrlAck::PENDING) { auto hidl_retval = Loading @@ -100,22 +94,16 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description(); } } main_thread_hwbinder_timer_stop(); return Void(); } Return<void> stopStream() override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); sink_->StopRequest(); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> getPresentationPosition( getPresentationPosition_cb _hidl_cb) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); uint64_t remote_delay_report_ns; uint64_t total_bytes_read; timespec data_position; Loading @@ -138,13 +126,10 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { : BluetoothAudioStatus::FAILURE), remote_delay_report_ns, total_bytes_read, transmittedOctetsTimeStamp); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> updateMetadata(const SourceMetadata& sourceMetadata) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); LOG(INFO) << __func__ << ": " << sourceMetadata.tracks.size() << " track(s)"; // refer to StreamOut.impl.h within Audio HAL (AUDIO_HAL_VERSION_5_0) Loading @@ -161,7 +146,6 @@ class BluetoothAudioPortImpl : public IBluetoothAudioPort { const source_metadata_t source_metadata = { .track_count = metadata_vec.size(), .tracks = metadata_vec.data()}; sink_->MetadataChanged(source_metadata); main_thread_hwbinder_timer_stop(); return Void(); } Loading
system/btif/src/bluetooth.cc +0 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,6 @@ #include "osi/include/osi.h" #include "osi/include/wakelock.h" #include "stack/gatt/connection_manager.h" #include "stack/include/btu.h" #include "stack_manager.h" using bluetooth::hearing_aid::HearingAidInterface; Loading Loading @@ -320,7 +319,6 @@ static void dump(int fd, const char** arguments) { btif_debug_av_dump(fd); bta_debug_av_dump(fd); stack_debug_avdtp_api_dump(fd); stack_debug_hwbinder_thread_dump(fd); bluetooth::avrcp::AvrcpService::DebugDump(fd); btif_debug_config_dump(fd); BTA_HfClientDumpStatistics(fd); Loading
system/hci/src/hci_layer_android.cc +0 −15 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <base/location.h> #include <base/logging.h> #include "btu.h" #include "buffer_allocator.h" #include "osi/include/log.h" Loading Loading @@ -90,46 +89,32 @@ class BluetoothHciCallbacks : public V1_1::IBluetoothHciCallbacks { } Return<void> initializationComplete(Status status) override { // Do not fire the hwbinder timer here because the main thread is blocked // before the initialization is completed. CHECK(status == Status::SUCCESS); initialization_complete(); return Void(); } Return<void> hciEventReceived(const hidl_vec<uint8_t>& event) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_EVT, event); hci_event_received(FROM_HERE, packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> aclDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_ACL, data); acl_event_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> scoDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_SCO, data); sco_data_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Return<void> isoDataReceived(const hidl_vec<uint8_t>& data) override { main_thread_hwbinder_timer_start( FROM_HERE_WITH_EXPLICIT_FUNCTION(__func__)); BT_HDR* packet = WrapPacketAndCopy(MSG_HC_TO_STACK_HCI_ISO, data); iso_data_received(packet); main_thread_hwbinder_timer_stop(); return Void(); } Loading
system/stack/btu/btu_task.cc +0 −95 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ #include "bte.h" #include "btif/include/btif_common.h" #include "common/message_loop_thread.h" #include "common/once_timer.h" #include "common/time_util.h" #include "osi/include/osi.h" #include "stack/btm/btm_int.h" #include "stack/include/btu.h" Loading @@ -40,51 +38,12 @@ #include <base/run_loop.h> #include <base/threading/thread.h> #ifndef HWBINDER_TIMEOUT_MS #define HWBINDER_TIMEOUT_MS 500 #endif using bluetooth::common::MessageLoopThread; using bluetooth::common::OnceTimer; /* Define utils for HwBinder timer dumpsys */ typedef struct { uint64_t counter_5ms = 0; uint64_t counter_20ms = 0; uint64_t counter_50ms = 0; uint64_t counter_100ms = 0; uint64_t counter_250ms = 0; uint64_t counter_max_ms = 0; void addTime(uint64_t time) { if (time < 5) { counter_5ms++; } else if (time < 20) { counter_20ms++; } else if (time < 50) { counter_50ms++; } else if (time < 100) { counter_100ms++; } else if (time < 250) { counter_250ms++; } else { counter_max_ms++; } } } hwbinder_timer_collector_t; typedef struct { uint64_t start_time_ms; std::string from_here; } hwbinder_timestamp_t; std::map<std::string, hwbinder_timer_collector_t> timer_map; hwbinder_timestamp_t hwbinder_timestamp; /* Define BTU storage area */ uint8_t btu_trace_level = HCI_INITIAL_TRACE_LEVEL; static MessageLoopThread main_thread("bt_main_thread"); static OnceTimer hwbinder_timer; void btu_hci_msg_process(BT_HDR* p_msg) { /* Determine the input message type. */ Loading Loading @@ -138,60 +97,6 @@ bt_status_t do_in_main_thread(const base::Location& from_here, return BT_STATUS_SUCCESS; } void hwbinder_timeout(const base::Location& from_here) { LOG(FATAL) << "HwBinder thread timeout at " << from_here.ToString(); } void main_thread_hwbinder_timer_start(const base::Location& from_here) { if (hwbinder_timer.IsScheduled()) { LOG(FATAL) << __func__ << ": hwbinder_timer is already scheduled!"; } if (!hwbinder_timer.Schedule( main_thread.GetWeakPtr(), from_here, base::Bind(&hwbinder_timeout, from_here), base::TimeDelta::FromMilliseconds(HWBINDER_TIMEOUT_MS))) { LOG(FATAL) << __func__ << ": failed from " << from_here.ToString(); } hwbinder_timestamp.start_time_ms = bluetooth::common::time_get_os_boottime_ms(); hwbinder_timestamp.from_here = from_here.ToString(); } void main_thread_hwbinder_timer_stop() { if (!hwbinder_timer.IsScheduled()) { LOG(FATAL) << __func__ << ": hwbinder_timer is not scheduled!"; } hwbinder_timer.CancelAndWait(); uint64_t delta_time = bluetooth::common::time_get_os_boottime_ms() - hwbinder_timestamp.start_time_ms; auto it = timer_map.find(hwbinder_timestamp.from_here); if (it == timer_map.end()) { hwbinder_timer_collector_t collector; collector.addTime(delta_time); timer_map.emplace(hwbinder_timestamp.from_here, collector); } else { it->second.addTime(delta_time); } } void stack_debug_hwbinder_thread_dump(int fd) { dprintf(fd, "\nHwBinder Thread Timer:\n"); for (auto it = timer_map.begin(); it != timer_map.end(); it++) { dprintf(fd, " %s:\n", it->first.c_str()); std::stringstream ss; ss << " Invoke Counts (5ms/20ms/50ms/100ms/250ms/Over 250ms) : " << std::to_string(it->second.counter_5ms) << " / " << std::to_string(it->second.counter_20ms) << " / " << std::to_string(it->second.counter_50ms) << " / " << std::to_string(it->second.counter_100ms) << " / " << std::to_string(it->second.counter_250ms) << " / " << std::to_string(it->second.counter_max_ms); dprintf(fd, "%s\n", ss.str().c_str()); } } void btu_task_start_up(UNUSED_ATTR void* context) { LOG(INFO) << "Bluetooth chip preload is complete"; Loading