bug: V/43595
Changes:
1. Enabled Kconfig option BLUETOOTH_DEBUG_TIMEVAL, choice BLUETOOTH_DEBUG_TIME_UNIT_US enable or not.
2. Included 'bt_debug.h' in Bluetooth service or Bluetooth stack (bluelet).
3. Usage instructions:
- In any function, first define the timeval structure by calling BT_DEBUG_MKTIMEVAL_S(name_s); at the global scope of the .c file.
- Then, within the function, call BT_DEBUG_ENTER_TIME_SECTION(name_s); to record the entry time.
- Finally, call BT_DEBUG_EXIT_TIME_SECTION(name_s); to record the exit time.
Example:
BT_DEBUG_MKTIMEVAL_S(hci_poll_recv); // Suggest using the function name; since '__func__' cannot be used in precompile state, you need to input it manually.
static void hci_poll_recv(service_poll_t* poll, int revent, void* userdata)
{
(void)poll;
(void)userdata;
if (revent & (POLL_ERROR | POLL_DISCONNECT))
hci_remove_recv(NULL);
if (revent & POLL_READABLE) {
BT_DEBUG_ENTER_TIME_SECTION(hci_poll_recv); // Record entry time.
bt_sal_hci_transport_recv();
BT_DEBUG_EXIT_TIME_SECTION(hci_poll_recv); // Record exit time.
}
}
Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>