Loading system/btif/include/btif_debug.h +0 −5 Original line number Diff line number Diff line Loading @@ -23,8 +23,3 @@ // Debug API void btif_debug_init(void); // Debug helpers // Timestamp in us uint64_t btif_debug_ts(void); system/btif/src/btif_debug.cc +0 −7 Original line number Diff line number Diff line Loading @@ -28,10 +28,3 @@ void btif_debug_init(void) { btif_debug_btsnoop_init(); #endif } // TODO: Find a better place for this to enable additional re-use uint64_t btif_debug_ts(void) { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec * 1000000LL) + tv.tv_usec; } system/btif/src/btif_debug_btsnoop.cc +5 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include "hci/include/btsnoop_mem.h" #include "include/bt_target.h" #include "osi/include/ringbuffer.h" #include "osi/include/time.h" #define REDUCE_HCI_TYPE_TO_SIGNIFICANT_BITS(type) ((type) >> 8) Loading @@ -50,7 +51,7 @@ static size_t btsnoop_calculate_packet_length(uint16_t type, size_t length); static void btsnoop_cb(const uint16_t type, const uint8_t* data, const size_t length) { const size_t length, const uint64_t timestamp_us) { btsnooz_header_t header; size_t included_length = btsnoop_calculate_packet_length(type, data, length); Loading @@ -67,14 +68,12 @@ static void btsnoop_cb(const uint16_t type, const uint8_t* data, } // Insert data const uint64_t now = btif_debug_ts(); header.type = REDUCE_HCI_TYPE_TO_SIGNIFICANT_BITS(type); header.length = included_length + 1; // +1 for type byte header.packet_length = length + 1; // +1 for type byte. header.delta_time_ms = last_timestamp_ms ? now - last_timestamp_ms : 0; last_timestamp_ms = now; header.delta_time_ms = last_timestamp_ms ? timestamp_us - last_timestamp_ms : 0; last_timestamp_ms = timestamp_us; ringbuffer_insert(buffer, (uint8_t*)&header, sizeof(btsnooz_header_t)); ringbuffer_insert(buffer, data, included_length); Loading system/btif/src/btif_debug_conn.cc +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ #include <time.h> #include "btcore/include/bdaddr.h" #include "btif/include/btif_debug.h" #include "btif/include/btif_debug_conn.h" #include "osi/include/time.h" #define NUM_CONNECTION_EVENTS 16 #define TEMP_BUFFER_SIZE 30 Loading Loading @@ -70,7 +70,7 @@ void btif_debug_conn_state(const bt_bdaddr_t bda, next_event(); conn_event_t* evt = &connection_events[current_event]; evt->ts = btif_debug_ts(); evt->ts = time_gettimeofday_us(); evt->state = state; evt->disconnect_reason = disconnect_reason; memcpy(&evt->bda, &bda, sizeof(bt_bdaddr_t)); Loading system/hci/include/btsnoop_mem.h +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ // Callback invoked for each HCI packet. // Highlander mode - there can be only one... typedef void (*btsnoop_data_cb)(const uint16_t type, const uint8_t* p_data, const size_t len); const size_t len, const uint64_t timestamp_us); // This call sets the (one and only) callback that will // be invoked once for each HCI packet/event. Loading @@ -34,4 +34,4 @@ void btsnoop_mem_set_callback(btsnoop_data_cb cb); // This function is invoked every time an HCI packet // is sent/received. Packets will be filtered and then // forwarded to the |btsnoop_data_cb|. void btsnoop_mem_capture(const BT_HDR* p_buf); void btsnoop_mem_capture(const BT_HDR* p_buf, const uint64_t timestamp_us); Loading
system/btif/include/btif_debug.h +0 −5 Original line number Diff line number Diff line Loading @@ -23,8 +23,3 @@ // Debug API void btif_debug_init(void); // Debug helpers // Timestamp in us uint64_t btif_debug_ts(void);
system/btif/src/btif_debug.cc +0 −7 Original line number Diff line number Diff line Loading @@ -28,10 +28,3 @@ void btif_debug_init(void) { btif_debug_btsnoop_init(); #endif } // TODO: Find a better place for this to enable additional re-use uint64_t btif_debug_ts(void) { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec * 1000000LL) + tv.tv_usec; }
system/btif/src/btif_debug_btsnoop.cc +5 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include "hci/include/btsnoop_mem.h" #include "include/bt_target.h" #include "osi/include/ringbuffer.h" #include "osi/include/time.h" #define REDUCE_HCI_TYPE_TO_SIGNIFICANT_BITS(type) ((type) >> 8) Loading @@ -50,7 +51,7 @@ static size_t btsnoop_calculate_packet_length(uint16_t type, size_t length); static void btsnoop_cb(const uint16_t type, const uint8_t* data, const size_t length) { const size_t length, const uint64_t timestamp_us) { btsnooz_header_t header; size_t included_length = btsnoop_calculate_packet_length(type, data, length); Loading @@ -67,14 +68,12 @@ static void btsnoop_cb(const uint16_t type, const uint8_t* data, } // Insert data const uint64_t now = btif_debug_ts(); header.type = REDUCE_HCI_TYPE_TO_SIGNIFICANT_BITS(type); header.length = included_length + 1; // +1 for type byte header.packet_length = length + 1; // +1 for type byte. header.delta_time_ms = last_timestamp_ms ? now - last_timestamp_ms : 0; last_timestamp_ms = now; header.delta_time_ms = last_timestamp_ms ? timestamp_us - last_timestamp_ms : 0; last_timestamp_ms = timestamp_us; ringbuffer_insert(buffer, (uint8_t*)&header, sizeof(btsnooz_header_t)); ringbuffer_insert(buffer, data, included_length); Loading
system/btif/src/btif_debug_conn.cc +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ #include <time.h> #include "btcore/include/bdaddr.h" #include "btif/include/btif_debug.h" #include "btif/include/btif_debug_conn.h" #include "osi/include/time.h" #define NUM_CONNECTION_EVENTS 16 #define TEMP_BUFFER_SIZE 30 Loading Loading @@ -70,7 +70,7 @@ void btif_debug_conn_state(const bt_bdaddr_t bda, next_event(); conn_event_t* evt = &connection_events[current_event]; evt->ts = btif_debug_ts(); evt->ts = time_gettimeofday_us(); evt->state = state; evt->disconnect_reason = disconnect_reason; memcpy(&evt->bda, &bda, sizeof(bt_bdaddr_t)); Loading
system/hci/include/btsnoop_mem.h +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ // Callback invoked for each HCI packet. // Highlander mode - there can be only one... typedef void (*btsnoop_data_cb)(const uint16_t type, const uint8_t* p_data, const size_t len); const size_t len, const uint64_t timestamp_us); // This call sets the (one and only) callback that will // be invoked once for each HCI packet/event. Loading @@ -34,4 +34,4 @@ void btsnoop_mem_set_callback(btsnoop_data_cb cb); // This function is invoked every time an HCI packet // is sent/received. Packets will be filtered and then // forwarded to the |btsnoop_data_cb|. void btsnoop_mem_capture(const BT_HDR* p_buf); void btsnoop_mem_capture(const BT_HDR* p_buf, const uint64_t timestamp_us);