Instrument data flow a bit
Use counters to grab some select data metrics.
diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c
index caef05f..e59b760 100755
--- a/stack/l2cap/l2c_main.c
+++ b/stack/l2cap/l2c_main.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include "controller.h"
+#include "counter.h"
#include "gki.h"
#include "hcimsgs.h"
#include "l2cdefs.h"
@@ -99,6 +100,9 @@
if (p_buf->len <= controller_get_interface()->get_acl_packet_size_classic())
{
+ counter_add("l2cap.ch2.tx.bytes", p_buf->len);
+ counter_add("l2cap.ch2.tx.pkts", 1);
+
bte_main_hci_send(p_buf, BT_EVT_TO_LM_HCI_ACL);
}
}
@@ -218,11 +222,15 @@
/* Send the data through the channel state machine */
if (rcv_cid == L2CAP_SIGNALLING_CID)
{
+ counter_add("l2cap.sig.rx.bytes", l2cap_len);
+ counter_add("l2cap.sig.rx.pkts", 1);
process_l2cap_cmd (p_lcb, p, l2cap_len);
GKI_freebuf (p_msg);
}
else if (rcv_cid == L2CAP_CONNECTIONLESS_CID)
{
+ counter_add("l2cap.ch2.rx.bytes", l2cap_len);
+ counter_add("l2cap.ch2.rx.pkts", 1);
/* process_connectionless_data (p_lcb); */
STREAM_TO_UINT16 (psm, p);
L2CAP_TRACE_DEBUG( "GOT CONNECTIONLESS DATA PSM:%d", psm ) ;
@@ -240,6 +248,8 @@
#if (BLE_INCLUDED == TRUE)
else if (rcv_cid == L2CAP_BLE_SIGNALLING_CID)
{
+ counter_add("l2cap.ble.rx.bytes", l2cap_len);
+ counter_add("l2cap.ble.rx.pkts", 1);
l2cble_process_sig_cmd (p_lcb, p, l2cap_len);
GKI_freebuf (p_msg);
}
@@ -248,6 +258,8 @@
else if ((rcv_cid >= L2CAP_FIRST_FIXED_CHNL) && (rcv_cid <= L2CAP_LAST_FIXED_CHNL) &&
(l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb != NULL) )
{
+ counter_add("l2cap.fix.rx.bytes", l2cap_len);
+ counter_add("l2cap.fix.rx.pkts", 1);
/* If no CCB for this channel, allocate one */
if (p_lcb &&
/* discard fixed channel data when link is disconnecting */
@@ -272,6 +284,8 @@
else
{
+ counter_add("l2cap.dyn.rx.bytes", l2cap_len);
+ counter_add("l2cap.dyn.rx.pkts", 1);
if (p_ccb == NULL)
GKI_freebuf (p_msg);
else
@@ -972,6 +986,9 @@
return (L2CAP_DW_FAILED);
}
+ counter_add("l2cap.dyn.tx.bytes", p_data->len);
+ counter_add("l2cap.dyn.tx.pkts", 1);
+
l2c_csm_execute (p_ccb, L2CEVT_L2CA_DATA_WRITE, p_data);
if (p_ccb->cong_sent)