diff options
author | 2025-03-10 12:05:03 -0700 | |
---|---|---|
committer | 2025-03-10 12:05:03 -0700 | |
commit | cec1e6042c02da796637836f497aced4919e320d (patch) | |
tree | d1637e2fc2e5ce45df5511edd9e780c9c4409bf5 /system/btif | |
parent | 0f695749114736aab905a0bf5184b19b651cdfec (diff) | |
parent | 933a7a5482a60923410712284d9e3d6ec63b06f1 (diff) |
Merge "system/common: Remove the BluetoothMetricsLogger helper" into main
Diffstat (limited to 'system/btif')
-rw-r--r-- | system/btif/src/bluetooth.cc | 6 | ||||
-rw-r--r-- | system/btif/src/btif_a2dp_source.cc | 28 | ||||
-rw-r--r-- | system/btif/src/btif_dm.cc | 24 | ||||
-rw-r--r-- | system/btif/src/btif_hf.cc | 3 |
4 files changed, 15 insertions, 46 deletions
diff --git a/system/btif/src/bluetooth.cc b/system/btif/src/bluetooth.cc index 1e3db0be50..5741b05c4f 100644 --- a/system/btif/src/bluetooth.cc +++ b/system/btif/src/bluetooth.cc @@ -82,7 +82,6 @@ #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager_t.h" #include "common/address_obfuscator.h" -#include "common/metrics.h" #include "common/os_utils.h" #include "device/include/device_iot_config.h" #include "device/include/esco_parameters.h" @@ -896,10 +895,6 @@ static void dump(int fd, const char** /*arguments*/) { log::debug("Finished bluetooth dumpsys"); } -static void dumpMetrics(std::string* output) { - bluetooth::common::BluetoothMetricsLogger::GetInstance()->WriteString(output); -} - static int get_remote_pbap_pce_version(const RawAddress* bd_addr) { // Read and restore the PCE version from local storage uint16_t pce_version = 0; @@ -1246,7 +1241,6 @@ EXPORT_SYMBOL bt_interface_t bluetoothInterface = { .set_os_callouts = set_os_callouts, .read_energy_info = read_energy_info, .dump = dump, - .dumpMetrics = dumpMetrics, .config_clear = config_clear, .interop_database_clear = interop_database_clear, .interop_database_add = interop_database_add, diff --git a/system/btif/src/btif_a2dp_source.cc b/system/btif/src/btif_a2dp_source.cc index 25a5fe7093..b8ace80b07 100644 --- a/system/btif/src/btif_a2dp_source.cc +++ b/system/btif/src/btif_a2dp_source.cc @@ -71,8 +71,6 @@ #endif using bluetooth::audio::a2dp::Status; -using bluetooth::common::A2dpSessionMetrics; -using bluetooth::common::BluetoothMetricsLogger; using bluetooth::common::RepeatingTimer; using namespace bluetooth; @@ -492,11 +490,6 @@ static void btif_a2dp_source_start_session_delayed(const RawAddress& peer_addres if (bluetooth::audio::a2dp::is_hal_enabled()) { bluetooth::audio::a2dp::start_session(); bluetooth::audio::a2dp::set_remote_delay(btif_av_get_audio_delay(A2dpType::kSource)); - BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart( - bluetooth::common::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); - } else { - BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart( - bluetooth::common::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); } peer_ready_promise.set_value(); @@ -550,11 +543,6 @@ static void btif_a2dp_source_end_session_delayed(const RawAddress& peer_address) } if (bluetooth::audio::a2dp::is_hal_enabled()) { bluetooth::audio::a2dp::end_session(); - BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd( - bluetooth::common::DISCONNECT_REASON_UNKNOWN, 0); - } else { - BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionEnd( - bluetooth::common::DISCONNECT_REASON_UNKNOWN, 0); } } @@ -1267,9 +1255,24 @@ void btif_a2dp_source_debug_dump(int fd) { (unsigned long long)ave_time_us / 1000); } +struct A2dpSessionMetrics { + int64_t audio_duration_ms = -1; + int32_t media_timer_min_ms = -1; + int32_t media_timer_max_ms = -1; + int32_t media_timer_avg_ms = -1; + int64_t total_scheduling_count = -1; + int32_t buffer_overruns_max_count = -1; + int32_t buffer_overruns_total = -1; + float buffer_underruns_average = -1; + int32_t buffer_underruns_count = -1; + int64_t codec_index = -1; + bool is_a2dp_offload = false; +}; + static void btif_a2dp_source_update_metrics(void) { BtifMediaStats stats = btif_a2dp_source_cb.stats; SchedulingStats enqueue_stats = stats.tx_queue_enqueue_stats; + A2dpSessionMetrics metrics; metrics.codec_index = stats.codec_index; metrics.is_a2dp_offload = btif_av_is_a2dp_offload_running(); @@ -1303,7 +1306,6 @@ static void btif_a2dp_source_update_metrics(void) { (float)stats.media_read_total_underflow_bytes / metrics.buffer_underruns_count; } } - BluetoothMetricsLogger::GetInstance()->LogA2dpSession(metrics); if (metrics.audio_duration_ms != -1) { log_a2dp_session_metrics_event(btif_av_source_active_peer(), metrics.audio_duration_ms, diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc index 84c7b7e1f6..96ed5848b1 100644 --- a/system/btif/src/btif_dm.cc +++ b/system/btif/src/btif_dm.cc @@ -62,7 +62,6 @@ #include "btif_storage.h" #include "btif_util.h" #include "common/lru_cache.h" -#include "common/metrics.h" #include "common/strings.h" #include "device/include/interop.h" #include "hci/controller_interface.h" @@ -3873,29 +3872,6 @@ static void btif_stats_add_bond_event(const RawAddress& bd_addr, bt_bond_functio if (btif_events_end_index == btif_events_start_index) { btif_events_start_index = (btif_events_start_index + 1) % (MAX_BTIF_BOND_EVENT_ENTRIES + 1); } - - int type; - btif_get_device_type(bd_addr, &type); - - bluetooth::common::device_type_t device_type; - switch (type) { - case BT_DEVICE_TYPE_BREDR: - device_type = bluetooth::common::DEVICE_TYPE_BREDR; - break; - case BT_DEVICE_TYPE_BLE: - device_type = bluetooth::common::DEVICE_TYPE_LE; - break; - case BT_DEVICE_TYPE_DUMO: - device_type = bluetooth::common::DEVICE_TYPE_DUMO; - break; - default: - device_type = bluetooth::common::DEVICE_TYPE_UNKNOWN; - break; - } - - uint32_t cod = btif_get_cod(&bd_addr); - uint64_t ts = event->timestamp.tv_sec * 1000 + event->timestamp.tv_nsec / 1000000; - bluetooth::common::BluetoothMetricsLogger::GetInstance()->LogPairEvent(0, ts, cod, device_type); } void btif_debug_bond_event_dump(int fd) { diff --git a/system/btif/src/btif_hf.cc b/system/btif/src/btif_hf.cc index 49e183d06b..33fb900e07 100644 --- a/system/btif/src/btif_hf.cc +++ b/system/btif/src/btif_hf.cc @@ -55,7 +55,6 @@ #include "btif/include/btif_profile_queue.h" #include "btif/include/btif_util.h" #include "btm_api_types.h" -#include "common/metrics.h" #include "device/include/device_iot_conf_defs.h" #include "device/include/device_iot_config.h" #include "hardware/bluetooth.h" @@ -434,8 +433,6 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) { btif_hf_cb[idx].state = BTHF_CONNECTION_STATE_CONNECTED; btif_hf_cb[idx].peer_feat = 0; clear_phone_state_multihf(&btif_hf_cb[idx]); - bluetooth::common::BluetoothMetricsLogger::GetInstance()->LogHeadsetProfileRfcConnection( - p_data->open.service_id); bt_hf_callbacks->ConnectionStateCallback(btif_hf_cb[idx].state, &btif_hf_cb[idx].connected_bda); } else { |