summaryrefslogtreecommitdiff
path: root/system/common/metrics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'system/common/metrics.cc')
-rw-r--r--system/common/metrics.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/system/common/metrics.cc b/system/common/metrics.cc
index 1ece069ab3..809b3c4d31 100644
--- a/system/common/metrics.cc
+++ b/system/common/metrics.cc
@@ -58,6 +58,9 @@ struct formatter<android::bluetooth::AddressTypeEnum>
template <>
struct formatter<android::bluetooth::DeviceInfoSrcEnum>
: enum_formatter<android::bluetooth::DeviceInfoSrcEnum> {};
+template <>
+struct formatter<android::bluetooth::SocketErrorEnum>
+ : enum_formatter<android::bluetooth::SocketErrorEnum> {};
} // namespace std
namespace bluetooth {
@@ -778,7 +781,10 @@ void LogSdpAttribute(const RawAddress& address, uint16_t protocol_uuid, uint16_t
void LogSocketConnectionState(const RawAddress& address, int port, int type,
android::bluetooth::SocketConnectionstateEnum connection_state,
int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
- android::bluetooth::SocketRoleEnum socket_role) {
+ android::bluetooth::SocketRoleEnum socket_role,
+ uint64_t connection_duration_ms,
+ android::bluetooth::SocketErrorEnum error_code,
+ bool is_hardware_offload) {
std::string obfuscated_id;
int metric_id = 0;
if (!address.IsEmpty()) {
@@ -790,14 +796,16 @@ void LogSocketConnectionState(const RawAddress& address, int port, int type,
address.IsEmpty() ? 0 : obfuscated_id.size());
int ret = stats_write(BLUETOOTH_SOCKET_CONNECTION_STATE_CHANGED, obfuscated_id_field, port, type,
connection_state, tx_bytes, rx_bytes, uid, server_port, socket_role,
- metric_id, 0 /* connection_duration_ms */, 1 /* error_code */,
- 0 /* is_hardware_offload */);
+ metric_id, static_cast<int64_t>(connection_duration_ms), error_code,
+ is_hardware_offload);
if (ret < 0) {
log::warn(
"failed for {}, port {}, type {}, state {}, tx_bytes {}, rx_bytes {}, "
- "uid {}, server_port {}, socket_role {}, error {}",
+ "uid {}, server_port {}, socket_role {}, error {}, connection_duration_ms {}, "
+ "socket_error_code {}, "
+ "is_hardware_offload {}",
address, port, type, connection_state, tx_bytes, rx_bytes, uid, server_port,
- socket_role, ret);
+ socket_role, ret, connection_duration_ms, error_code, is_hardware_offload);
}
}