summaryrefslogtreecommitdiff
path: root/system/common/metrics.cc
AgeCommit message (Collapse)Author
2025-03-17system/common: Move remaining metrics to os/metrics.h Henri Chataing
Bug: 401588157 Test: m com.android.bt Flag: EXEMPT, no logical change Change-Id: I6a7269d1084f86d0d12ee4ba8d040a6ef441a069
2025-03-13system/common: Remove unsued metrics helpers Henri Chataing
Bug: 401588157 Test: m com.android.bt Flag: EXEMPT, dead code removal Change-Id: I6f9839b92edece32ae25474af8f52ec98b12f54d
2025-03-11Merge "Add metrics logging for Bluetooth offload socket" into main Liang Li
2025-03-10Merge "system/common: Remove the BluetoothMetricsLogger helper" into main Treehugger Robot
2025-03-10Add metrics logging for Bluetooth offload socket Liang Li
Bug: 399022276 Flag: EXEMPT, metrics update Test: m com.google.android.bt Test: Android Data Hub Atom Tester Change-Id: Ib5a4a0d6970287388851bcf5fdb71121e3092b76
2025-03-07Update arguments of stats_write for socket metrics with empty values Liang Li
The new arguments are needed due to the new fields being added to the BluetoothSocketConnectionStateChanged atom. These empty values will be replaced with acutal values in a separate change. Bug: 399022276 Test: m com.google.android.bt Flag: EXEMPT, metrics logging Ignore-AOSP-First: workflow for modifying existing atoms Change-Id: Ie0441325cb6d02ebe0355602e86e9df9eca66c74
2025-03-07system/common: Remove the BluetoothMetricsLogger helper Henri Chataing
BluetoothMetricsLogger produces metrics logs that are packaged into a protobuf binary using the format system/gd/proto/metrics/bluetooth.proto This legacy logging method is no longer use in practical application and needs to be removed Bug: 401588157 Test: m com.android.bt Flag: EXEMPT, dead code removal Change-Id: I827079276082460eceb9bee728ef25771bc5b5db
2024-11-20system: Migrate from {fmt} to std::format Henri Chataing
Bug: 305066880 Test: m com.android.btservices Flag: EXEMPT, log change Change-Id: If1dbab99250a4f62626206fc9f73d27e71ebab56
2024-09-16metric: Remove deprecated and unused LogLeBluetoothConnectionMetricEvent Henri Chataing
Bug: 331817295 Flag: EXEMPT, deadcode removal Test: m com.android.btservices Change-Id: I22ee1da45e8dde171a4965b849fb413bb308f4b7
2024-08-09Metrics: Use the device type for sessions Myles Watson
Bug: 358663571 Test: mma -j32 Flag: EXEMPT, no logical change Change-Id: I6aba56f74b6d4fc66b2a1bccc3fe9f6d248a6b93
2024-07-10Merge "BluetoothMetrics: Reuse metric id allocator from ↵ Palash Ahuja
system/gd/common/metric_id_manager.cc" into main
2024-07-09BluetoothMetrics: Reuse metric id allocator Palash Ahuja
from system/gd/common/metric_id_manager.cc Bug: 352056989 Test: m com.android.btservices and statsd_testdrive Flag: EXEMPT, metrics related changes Change-Id: Ib5858cc8c72cde3282c43fa06d0c481bcbb02aa7
2024-07-07Format: apply clang rules William Escande
Restore SpacesBeforeTrailingComments to 2 to match current style Then run clang-format -i **/**.{c,h,cc,cpp,hpp} Then fix a bunch of typo (reported by gerrit) Then fix unnecessary multiline string Then fix whitespace for disabled clang format (reported by cpplint) This is no-op Bug: 311772251 Test: mmm packages/modules/Bluetooth Flag: Exempt Format only Change-Id: If135447803a40a2a07d4630ba2195e08ef8d250c
2024-05-27LEA metrics use the same mechanim in system/gd/common for allocating metrics ID. silens
Not use the mechanim in system/common Bug: 341843517 Flag: EXEMPT, modify metrics related code Test: atest --host bluetooth_le_audio_client_test:MetricsCollectorTest Change-Id: I4c612b07f24660a162586bdb04c78271dfe31f9b
2024-04-24system: Replace loghex by {:x} in log calls Henri Chataing
Other cleanup changes applied based on existing passes in the cleanup script used Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: Ie8daf0e6723f4e4deffaa4c00c1c3cb01b594662
2024-04-18system: Remove most ADDRESS_TO_LOGGABLE_(CSTR|STR) Henri Chataing
The added formatters for address types have all the same behavior. ADDRESS_TO_LOGGABLE_STR still occurs in BTM_History, dumpsys, log::assert_that calls Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: I950f76bd2f1d000638752759a3f08ba0be6f014c
2024-04-05Remove includes of <base/logging.h> Henri Chataing
Convert remaining DLOG, LOG, CHECK_xx occurences in the same pass Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: I7ae3e14c84b6ee5dc2ac0babc652c699c7424418
2024-03-21system/common: Migrate to libbluetooth_log Henri Chataing
Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: I04bae75c77e7fd421884f5ff122c794cf229d44e
2024-01-08Remove gd prefix from include files Myles Watson
Bug: 301661850 Test: mma -j32 Flag: EXEMPT, inclusion path changes Change-Id: Ibc58a0e8af5f3828caa69b82118051b14b417e43
2023-12-20internal_include/bt_trace: IWYU and remove unused Chris Manton
Bug: 317216484 Test: m . Flag: EXEMPT, IWYU Change-Id: Ibba4717f106d6a8745a81595654c7225cb266794
2023-03-22Revert "Revert "[BluetoothMetrics] This covers the case for Direct LE-AC..."" Palash Ahuja
This reverts commit 5a00b850b0ebdb337effb97564d46d8ee497f307. Reason for revert: Adding the fix for the floss build Change-Id: Ia02811feed9403643dc8d415903bfeea229c0ebb
2023-03-23Revert "[BluetoothMetrics] This covers the case for Direct LE-AC..." Abhishek Pandit-Subedi
Revert submission 2496315-bluetooth-le-connection-session Reason for revert: Breaks flossbuild (caught by presubmit and bypassed) Reverted changes: /q/submissionid:2496315-bluetooth-le-connection-session Change-Id: Ie355f78d4c535b5fa44c3451d420302c679eb862
2023-03-21[BluetoothMetrics] This covers the case for Direct LE-ACL Connection Palash Ahuja
Success Rate as per go/bluetooth-le-connection-metrics. Unit Tests: - Successful - Failure - Timeout - Cancellation Test: atest bluetooth_test_gd_unit:LEConnectionMetricsRemoteDeviceTest --host Change-Id: I7b8618c30d5f1e4dc5b9665e056934c2db888271 Merged-In: I7b8618c30d5f1e4dc5b9665e056934c2db888271
2022-08-24Add LeAudioBroadcastSession Josh Wu
* Add Broadcast methods to MetricsCollector * Implement LogLeAudioBroadcastSessionReported logging API * Add Broadcast cases to MetricsCollectorTest Test: atest BluetoothInstrumentationTests Tag: #feature Bug: 207811438 Change-Id: I9858d3841de7e3244acc3ff62efe2e497b08899a Merged-In: I9858d3841de7e3244acc3ff62efe2e497b08899a (cherry picked from commit 4cb702cc4e4d6614b08960245b41f6bee599029f)
2022-06-07BluetoothMetrics: Log the first 3 byte of MAC address to the metrics server Chen Chen
Bug: 230023257 Test: atest BluetoothInstrumentationTests Change-Id: I9049dbd8e04786b1aba31badbbd41e67e7daa574 Merged-In: I9049dbd8e04786b1aba31badbbd41e67e7daa574 (cherry picked from e1d73d8950d6909347b8c6a4ac3dca27fb912157)
2022-05-23Add LeAudioConnectionSession Josh Wu
* Add MetricsCollector for LeAudio * Implement LogLeAudioConnectionSessionReported logging API * Add MetricsCollectorTest under bluetooth_le_audio_test Test: atest BluetoothInstrumentationTests Tag: #feature Bug: 207811438 Change-Id: Iaa50e0a7986bae8919cd2e7d280a5303dbcc6d1f Merged-In: Iaa50e0a7986bae8919cd2e7d280a5303dbcc6d1f
2021-09-24Use bluetooth-specific statslog Muhammad Qureshi
Use generated statslog_bt that contains a subset of stats_write methods only required for bluetooth module. This replaces monolithic libstatslog. There's currently a stats_write method signature collision with another atom (b/200741446). This fixes the collision by only linking against stats_write() methods needed for atoms with the 'bluetooth' module annotation. Bug: 200741446 Tag: #refactor Test: atest net_test_btif Test: atest net_test_btif_profile_queue Test: gd/cert/run Test: m libbtif Test: m libbluetooth Test: m bt_headless Test: m libstatslog_bt Test: m Change-Id: I4323117ddcdd344e2dcf15a7631e2dec37f0b38f
2021-09-24legacy: Explicitly include types/raw_address Chris Manton
Bug: 197478351 Tag: #refactor Test: gd/cert/run Change-Id: I6eedcf3455ab278094a2e4e47f8cede84d96fd25
2021-04-28BluetoothMetrics: Remove MetricIdAllocator reference from HalCrashReason Chen Chen
Calling MetricIdAllocator may break its singleton pattern when stack is half gd and half legacy. Since we are not inputing metric id at this point, the easiest way is to just delete the reference. Bug: 181819141 Test: atest --host bluetooth_test_common Tag: #stability Change-Id: If4bf0a87a55ef4ee5460065c43577ed22d7b28eb
2021-03-31A2DP: Log BLUETOOTH_A2DP_PLAYBACK_STATE_CHANGED Josh Wu
Enable BLUETOOTH_A2DP_PLAYBACK_STATE_CHANGED Result metrics logged in stack Tag: #feature Bug: 183473902 Test: atest BluetoothInstrumentationTests Change-Id: I9e9b7d1d0e6fd094978ccaad9c16a0e2306e7882
2021-03-04Bluetooth hal metrics: Add LogBluetoothHalCrashReason weichinweng
Add LogBluetoothHalCrashReason function to collect Bluetooth hal crash reason. Bug: 174284338 Tag: #feature Test: atest BluetoothInstrumentationTests Change-Id: Ibbc465d3145068fdc7f743b67ae4278b4cdf2430
2020-03-30Bluetooth Metric Id: Add metric id allocation to Bluetooth Chen Chen
metric calls Test: Build successfully Bug: 142563377 Change-Id: I5d34d745fc09fcfac38e583765c6762bc943d7b0 Merged-In: I5d34d745fc09fcfac38e583765c6762bc943d7b0 (cherry picked from commit 31dfc91e66903a3dcb71bc6ba5da46597c98d1e2)
2019-03-20Add event_value to BluetoothClassicPairingEventReported Jack He
* Add an event_value field to log status value such as - encryption enabled state - simple pairing mode - secure connection host support - delete all flag * Use the event_value field to log above information during classic pairing process instead Bug: 128966402 Test: make Change-Id: I2a87c3837754bfc5bcd55f72325400c428c2ca25
2019-02-08Metrics: Log manfuacturer information from Device ID profile to statsd Jack He
Bug: 112969790 Test: make, test drive with statsd Change-Id: Ie22aaad07037f97017186ad1f1d9ad124e4756c0
2019-02-08Metrics: Log L2CAP and RFCOMM socket connection state changes to statsd Jack He
* Log L2CAP LE Coc, L2CAP BREDR, and RFCOMM socket connection state changes, including port number, socket type, connection states, number of bytes sent and received, server port number, uid of socket owner * Address is empty if this is a server port Bug: 112969790 Test: make, test drive with statsd Change-Id: Ic0ee93a6d9e4fa4109ddb89dea5e92907c49f2fc
2019-02-06Metrics: Log SDP attributes to statsd Jack He
* Log ProtocolDescriptorList's protocol version field to statsd * Log BluetoothProfileDescriptorList's profile version field to statsd * Log SupportedFeatures for A2DP, HFP, AVRCP, PBAP, MAP to statsd * Log SDP metrics before we disconnect from L2CAP during SDP discovery * Values are logged in small endian array * Do this logging before we declare an SDP search is done Bug: 112969790 Test: make, test drive with statsd Change-Id: Idd340e495ecb85abc27de2b2d71305ee5218b43c
2019-01-31Metrics: Add classic pairing metrics Jack He
* Log HCI commands and events related to classic pairing * Move all metrics logging for sending HCI command into a single function * Move all metrics logging for HCI command status into a single function * Move all metrics logging for HCI Command complete into a single function * Move all metrics logging for HCI events into a single function * Make sure we log all instances of HCI command sending methods, including those with desinated callbacks Bug: 112969790 Test: make, testdrive with statsd Change-Id: I4b1ca4ee814096d84bcd93c8d7206b0a771a3210
2019-01-31Metrics: Log SMP pairing commands Jack He
* Log SMP pairing commands and pairing failure reasons Bug: 112969790 Test: make, testdrive with statsd Change-Id: I51ae2af981a687954f7de3cee3caacce43d782b6
2019-01-30Metrics: Log A2DP playback related atoms to StatsLog Jack He
* BluetoothA2dpAudioOverrunReported - Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit buffer queue is full and we have to drop data * BluetoothA2dpAudioUnderrunReported - Logs when A2DP failed to read from PCM source * BluetoothDeviceRssiReported - Logged when remote device's RSSI level is reported by the controller * BluetoothDeviceFailedContactCounterReported - Logged when ACL transmit queue was flushed by the controller - This is normally disabled unless we set automatic flush timeout was set to a non-zero value - However, when this event is reported, the connection quality must be very bad * BluetoothDeviceTxPowerLevelReported - Logged when transmit power level is reported for a particular connection Note on num_dropped_nanoseconds entry: - This is the duration of audio dropped and is calculated by multiplying the number of encoding actions with length of encoding interval Bug: 112969790 Test: make, testdrive with statsd Change-Id: Ie6aa5ee71dea213e452497dd181fee91eea8f7b4
2019-01-29Metrics: add remote version info log to statsd Jack He
Bug: 112969790 Test: make, test drive with statsd Change-Id: I79037ddb6c4af3bf3e5cc8a890c8ee66652b8a81
2019-01-29Metrics: Log HCI timeout event over stats log Jack He
Fixes: 121213292 Bug: 111812273 Test: make, test drive with statsd Change-Id: I9bab0078a1e45c9811fd63f4c5aef9f4704ac555
2019-01-16Metric: Add logging for link layer connection events Jack He
* Logs when there is an event affecting Bluetooth device's link layer connection. Triggerred when there is a related HCI command or event * Users of this metrics can deduce Bluetooth device's connection state from these events * HCI commands are logged before the command is sent, after receiving, command status, and after receiving command complete event comes back * HCI events are logged when they arrive * Simplifies logic in btu_hcif_hdl_command_status() since p_cmd is never null and we always ignore parameter total length field * Call btm_identity_addr_to_random_pseudo() when parsing command status packet for LE create connection, extended create connection, add/remove/clear whitelist commands DETAILS: * Bluetooth classic commands: - CMD_CREATE_CONNECTION - CMD_DISCONNECT - CMD_CREATE_CONNECTION_CANCEL - CMD_ACCEPT_CONNECTION_REQUEST - CMD_REJECT_CONNECTION_REQUEST - CMD_SETUP_ESCO_CONNECTION - CMD_ACCEPT_ESCO_CONNECTION - CMD_REJECT_ESCO_CONNECTION - CMD_ENH_SETUP_ESCO_CONNECTION - CMD_ENH_ACCEPT_ESCO_CONNECTION * Bluetooth low energy commands: - CMD_BLE_CREATE_LL_CONN [Only logged when there is an error or initiator filter policy is 0x00] - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error] - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00] - CMD_BLE_CLEAR_WHITE_LIST - CMD_BLE_ADD_WHITE_LIST - CMD_BLE_REMOVE_WHITE_LIST * Bluetooth classic events: - EVT_CONNECTION_COMP - EVT_CONNECTION_REQUEST - EVT_DISCONNECTION_COMP - EVT_ESCO_CONNECTION_COMP - EVT_ESCO_CONNECTION_CHANGED * Bluetooth low energy meta events: - BLE_EVT_CONN_COMPLETE_EVT - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT Bug: 112969790 Test: make and test drive statsd Change-Id: Ib843dfa95bb6448c41dac261dabcf17947efda06
2018-08-27Move metrics and time library to libbt-common Jack He
* libbt-osi is being deprecated and libbt-common will replace it * Move recently implemented metrics library to libbt-common * Move time library from libbt-osi to libbt-common and renamed as time_util to avoid potention name collision with system time libraries * Need to keep time library for now because we need to use CLOCK_BOOTTIME that include system suspension time for A2DP encoding * Use libchrome logging methods in metrics library * Put both metrics and time_util into bluetooth::common namespace * Return uint64_t for time_get_os_boottime_ms and update various receiver types * Remove tBTM_CB.max_collision_delay and use the constant BTM_SEC_MAX_COLLISION_DELAY instead Bug: 111568640 Test: mm -j40, unit test, stream music Change-Id: I8c384a810d592bb6b9eb322134e947d066489ba4