OSDN Git Service

Bluetooth - Add tracing for TX queue and LDAC ABR
authorPhilip Cuadra <philipcuadra@google.com>
Fri, 9 Jun 2017 21:36:06 +0000 (14:36 -0700)
committerPhilip Cuadra <philipcuadra@google.com>
Thu, 29 Jun 2017 21:35:42 +0000 (21:35 +0000)
For debugging, add tracing to show the length of the TX queue and the
LDAC ABR level.

Test:  Ran bluetooth, took a systrace

Change-Id: Ia23764d68f27ae8209e37c4a0836852d73cf6cbc

btif/src/btif_a2dp_source.cc
stack/Android.bp
stack/a2dp/a2dp_vendor_ldac_encoder.cc

index d200621..d49dfeb 100644 (file)
  ******************************************************************************/
 
 #define LOG_TAG "bt_btif_a2dp_source"
+#define ATRACE_TAG ATRACE_TAG_AUDIO
 
 #include <base/logging.h>
+#include <cutils/trace.h>
 #include <limits.h>
 #include <string.h>
 #include <algorithm>
@@ -660,10 +662,11 @@ static void btif_a2dp_source_audio_handle_timer(UNUSED_ATTR void* context) {
 
   if (alarm_is_scheduled(btif_a2dp_source_cb.media_alarm)) {
     CHECK(btif_a2dp_source_cb.encoder_interface != NULL);
+    size_t transmit_queue_length =
+        fixed_queue_length(btif_a2dp_source_cb.tx_audio_queue);
+    ATRACE_INT("btif TX queue", transmit_queue_length);
     if (btif_a2dp_source_cb.encoder_interface->set_transmit_queue_length !=
         NULL) {
-      size_t transmit_queue_length =
-          fixed_queue_length(btif_a2dp_source_cb.tx_audio_queue);
       btif_a2dp_source_cb.encoder_interface->set_transmit_queue_length(
           transmit_queue_length);
     }
index 0e82edd..f5ec040 100644 (file)
@@ -195,6 +195,7 @@ cc_test {
     srcs: ["test/stack_a2dp_test.cc"],
     shared_libs: [
         "liblog",
+        "libcutils",
     ],
     static_libs: [
         "libbt-stack",
index 68deea8..47f7764 100644 (file)
  */
 
 #define LOG_TAG "a2dp_vendor_ldac_encoder"
+#define ATRACE_TAG ATRACE_TAG_AUDIO
 
 #include "a2dp_vendor_ldac_encoder.h"
 
+#include <cutils/trace.h>
 #include <dlfcn.h>
 #include <inttypes.h>
 #include <stdio.h>
@@ -545,6 +547,7 @@ void a2dp_vendor_ldac_send_frames(uint64_t timestamp_us) {
                              a2dp_ldac_encoder_cb.TxQueueLength, flag_enable);
       if (prev_eqmid != a2dp_ldac_encoder_cb.last_ldac_abr_eqmid)
         a2dp_ldac_encoder_cb.ldac_abr_adjustments++;
+      ATRACE_INT("LDAC ABR level", a2dp_ldac_encoder_cb.last_ldac_abr_eqmid);
     }
     // Transcode frame and enqueue
     a2dp_ldac_encode_frames(nb_frame);