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

Commit c8003d2e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7468789 from 144a2679 to sc-release

Change-Id: Id753c4d41f4615af35456efd1530c4b72c15affe
parents b1d28b0b 144a2679
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "common/stop_watch_legacy.h"

#include <iomanip>
#include <mutex>
#include <sstream>
#include <utility>

@@ -31,16 +32,29 @@ namespace common {
static const int LOG_BUFFER_LENGTH = 10;
static std::array<StopWatchLog, LOG_BUFFER_LENGTH> stopwatch_logs;
static int current_buffer_index;
static std::recursive_mutex stopwatch_log_mutex;

void StopWatchLegacy::RecordLog(StopWatchLog log) {
  std::unique_lock<std::recursive_mutex> lock(stopwatch_log_mutex, std::defer_lock);
  if (!lock.try_lock()) {
    LOG_INFO("try_lock fail. log content: %s, took %zu us", log.message.c_str(),
             static_cast<size_t>(
                 std::chrono::duration_cast<std::chrono::microseconds>(
                     stopwatch_logs[current_buffer_index].end_timestamp -
                     stopwatch_logs[current_buffer_index].start_timestamp)
                     .count()));
    return;
  }
  if (current_buffer_index >= LOG_BUFFER_LENGTH) {
    current_buffer_index = 0;
  }
  stopwatch_logs[current_buffer_index] = std::move(log);
  current_buffer_index++;
  lock.unlock();
}

void StopWatchLegacy::DumpStopWatchLog() {
  std::lock_guard<std::recursive_mutex> lock(stopwatch_log_mutex);
  LOG_INFO("=====================================");
  LOG_INFO("bluetooth stopwatch log history:");
  for (int i = 0; i < LOG_BUFFER_LENGTH; i++) {
@@ -48,7 +62,8 @@ void StopWatchLegacy::DumpStopWatchLog() {
      current_buffer_index = 0;
    }
    if (stopwatch_logs[current_buffer_index].message.empty()) {
      break;
      current_buffer_index++;
      continue;
    }
    std::stringstream ss;
    auto now = stopwatch_logs[current_buffer_index].timestamp;
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ LOCAL_host_libraries := \
	$(HOST_OUT_SHARED_LIBRARIES)/libz-host.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-full.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libunwindstack.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libdexfile_support.so \
	$(HOST_OUT_SHARED_LIBRARIES)/liblzma.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libbacktrace.so

+0 −1
Original line number Diff line number Diff line
@@ -324,7 +324,6 @@ function incremental_venv {
    cp {$HOST_LIB,$DEST_LIB_DIR}/libz-host.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libprotobuf-cpp-full.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libunwindstack.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libdexfile_support.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/liblzma.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libbacktrace.so

+16 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "common/stop_watch.h"

#include <iomanip>
#include <mutex>
#include <sstream>
#include <utility>

@@ -31,16 +32,29 @@ namespace common {
static const int LOG_BUFFER_LENGTH = 10;
static std::array<StopWatchLog, LOG_BUFFER_LENGTH> stopwatch_logs;
static int current_buffer_index;
static std::recursive_mutex stopwatch_log_mutex;

void StopWatch::RecordLog(StopWatchLog log) {
  std::unique_lock<std::recursive_mutex> lock(stopwatch_log_mutex, std::defer_lock);
  if (!lock.try_lock()) {
    LOG_INFO("try_lock fail. log content: %s, took %zu us", log.message.c_str(),
             static_cast<size_t>(
                 std::chrono::duration_cast<std::chrono::microseconds>(
                     stopwatch_logs[current_buffer_index].end_timestamp -
                     stopwatch_logs[current_buffer_index].start_timestamp)
                     .count()));
    return;
  }
  if (current_buffer_index >= LOG_BUFFER_LENGTH) {
    current_buffer_index = 0;
  }
  stopwatch_logs[current_buffer_index] = std::move(log);
  current_buffer_index++;
  lock.unlock();
}

void StopWatch::DumpStopWatchLog() {
  std::lock_guard<std::recursive_mutex> lock(stopwatch_log_mutex);
  LOG_INFO("=====================================");
  LOG_INFO("bluetooth stopwatch log history:");
  for (int i = 0; i < LOG_BUFFER_LENGTH; i++) {
@@ -48,7 +62,8 @@ void StopWatch::DumpStopWatchLog() {
      current_buffer_index = 0;
    }
    if (stopwatch_logs[current_buffer_index].message.empty()) {
      break;
      current_buffer_index++;
      continue;
    }
    std::stringstream ss;
    auto now = stopwatch_logs[current_buffer_index].timestamp;
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ class InternalHciCallbacks : public IBluetoothHciCallbacks {
  }

  Return<void> initializationComplete(HidlStatus status) {
    common::StopWatch(__func__);
    ASSERT(status == HidlStatus::SUCCESS);
    init_promise_->set_value();
    return Void();
Loading