Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32e3373d authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

Add logs to RoundRobinScheduler

To check if RoudRobinScheduler is working correctly.

Bug: 350166121
Flag: EXEMPT, only logs are added
Test: m -j;

Change-Id: I6fad8ff85ab321734e3d72340be2b7b188448dce
parent 6ddb61d6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@

#include <bluetooth/log.h>

#include <memory>
#include <utility>

#include "hci/acl_manager/acl_fragmenter.h"
namespace bluetooth {
namespace hci {
@@ -49,7 +52,10 @@ void RoundRobinScheduler::Register(ConnectionType connection_type, uint16_t hand
  acl_queue_handler acl_queue_handler = {connection_type, std::move(queue), false, 0};
  acl_queue_handlers_.insert(
          std::pair<uint16_t, RoundRobinScheduler::acl_queue_handler>(handle, acl_queue_handler));
  log::info("registering acl_queue handle={}, acl_credits={}, le_credits={}", handle,
            acl_packet_credits_, le_acl_packet_credits_);
  if (fragments_to_send_.size() == 0) {
    log::info("start round robin");
    start_round_robin();
  }
}
@@ -58,6 +64,8 @@ void RoundRobinScheduler::Unregister(uint16_t handle) {
  log::assert_that(acl_queue_handlers_.count(handle) == 1,
                   "assert failed: acl_queue_handlers_.count(handle) == 1");
  auto acl_queue_handler = acl_queue_handlers_.find(handle)->second;
  log::info("unregistering acl_queue handle={}, sent_packets={}", handle,
            acl_queue_handler.number_of_sent_packets_);
  // Reclaim outstanding packets
  if (acl_queue_handler.connection_type_ == ConnectionType::CLASSIC) {
    acl_packet_credits_ += acl_queue_handler.number_of_sent_packets_;
@@ -89,6 +97,7 @@ uint16_t RoundRobinScheduler::GetLeCredits() { return le_acl_packet_credits_; }

void RoundRobinScheduler::start_round_robin() {
  if (acl_packet_credits_ == 0 && le_acl_packet_credits_ == 0) {
    log::warn("Both buffers are full");
    return;
  }
  if (!fragments_to_send_.empty()) {