Loading system/common/stop_watch_legacy.cc +16 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "common/stop_watch_legacy.h" #include <iomanip> #include <mutex> #include <sstream> #include <utility> Loading @@ -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++) { Loading @@ -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; Loading system/gd/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -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 Loading system/gd/cert/run +0 −1 Original line number Diff line number Diff line Loading @@ -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 Loading system/gd/common/stop_watch.cc +16 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "common/stop_watch.h" #include <iomanip> #include <mutex> #include <sstream> #include <utility> Loading @@ -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++) { Loading @@ -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; Loading system/gd/hal/hci_hal_android_hidl.cc +1 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
system/common/stop_watch_legacy.cc +16 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "common/stop_watch_legacy.h" #include <iomanip> #include <mutex> #include <sstream> #include <utility> Loading @@ -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++) { Loading @@ -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; Loading
system/gd/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
system/gd/cert/run +0 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
system/gd/common/stop_watch.cc +16 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "common/stop_watch.h" #include <iomanip> #include <mutex> #include <sstream> #include <utility> Loading @@ -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++) { Loading @@ -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; Loading
system/gd/hal/hci_hal_android_hidl.cc +1 −0 Original line number Diff line number Diff line Loading @@ -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