Commit Graph

3 Commits

Author SHA1 Message Date
zhongzhijie1 43018e3c48 Rename helper func get_os_timestamp_xx to bt_get_os_timestamp_xx avoid
naming confict.

bug: v/59638

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-06-19 21:19:12 +08:00
zhongzhijie1 000d78ac06 [feat] Implement easy insertion of timeval measurements.
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>
2024-12-26 22:41:40 +08:00
openvela-robot cf07bea530 Merge commit
Change-Id: If26995eebd18a82ac4cd827e6801458e57a6ead3
2024-11-25 17:34:53 +08:00