diff options
author | 2022-05-05 01:29:04 -0700 | |
---|---|---|
committer | 2022-05-23 17:26:56 +0000 | |
commit | c033a1658860afda227ee2d38193b0d987ef58a3 (patch) | |
tree | b8742d25cbe0d7a7723d075f2c5d65707e825ba0 /system/common/metrics.cc | |
parent | b55c3d203b5732a74bd471bd7c4b8df5b4260fe0 (diff) |
Add LeAudioConnectionSession
* 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
Diffstat (limited to 'system/common/metrics.cc')
-rw-r--r-- | system/common/metrics.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/system/common/metrics.cc b/system/common/metrics.cc index 47870e0402..be1d1b3bac 100644 --- a/system/common/metrics.cc +++ b/system/common/metrics.cc @@ -908,6 +908,55 @@ void LogBluetoothHalCrashReason(const RawAddress& address, uint32_t error_code, } } +void LogLeAudioConnectionSessionReported( + int32_t group_size, int32_t group_metric_id, + int64_t connection_duration_nanos, + std::vector<int64_t>& device_connecting_offset_nanos, + std::vector<int64_t>& device_connected_offset_nanos, + std::vector<int64_t>& device_connection_duration_nanos, + std::vector<int32_t>& device_connection_status, + std::vector<int32_t>& device_disconnection_status, + std::vector<RawAddress>& device_address, + std::vector<int64_t>& streaming_offset_nanos, + std::vector<int64_t>& streaming_duration_nanos, + std::vector<int32_t>& streaming_context_type) { + std::vector<int32_t> device_metric_id(device_address.size()); + for (uint64_t i = 0; i < device_address.size(); i++) { + if (!device_address[i].IsEmpty()) { + device_metric_id[i] = + MetricIdAllocator::GetInstance().AllocateId(device_address[i]); + } else { + device_metric_id[i] = 0; + } + } + int ret = stats_write( + LE_AUDIO_CONNECTION_SESSION_REPORTED, group_size, group_metric_id, + connection_duration_nanos, device_connecting_offset_nanos, + device_connected_offset_nanos, device_connection_duration_nanos, + device_connection_status, device_disconnection_status, device_metric_id, + streaming_offset_nanos, streaming_duration_nanos, streaming_context_type); + if (ret < 0) { + LOG(WARNING) << __func__ << ": failed for group " << group_metric_id + << "device_connecting_offset_nanos[" + << device_connecting_offset_nanos.size() << "], " + << "device_connected_offset_nanos[" + << device_connected_offset_nanos.size() << "], " + << "device_connection_duration_nanos[" + << device_connection_duration_nanos.size() << "], " + << "device_connection_status[" + << device_connection_status.size() << "], " + << "device_disconnection_status[" + << device_disconnection_status.size() << "], " + << "device_metric_id[" << device_metric_id.size() << "], " + << "streaming_offset_nanos[" << streaming_offset_nanos.size() + << "], " + << "streaming_duration_nanos[" + << streaming_duration_nanos.size() << "], " + << "streaming_context_type[" << streaming_context_type.size() + << "]"; + } +} + } // namespace common } // namespace bluetooth |