diff --git a/mediapipe/gpu/BUILD b/mediapipe/gpu/BUILD index 56e3ceaf73..ba6e7f7cef 100644 --- a/mediapipe/gpu/BUILD +++ b/mediapipe/gpu/BUILD @@ -765,6 +765,7 @@ cc_library( "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", ], ) diff --git a/mediapipe/gpu/reusable_pool.h b/mediapipe/gpu/reusable_pool.h index 6f76c9a030..ffa24b8191 100644 --- a/mediapipe/gpu/reusable_pool.h +++ b/mediapipe/gpu/reusable_pool.h @@ -28,6 +28,7 @@ #include "absl/functional/any_invocable.h" #include "absl/log/absl_log.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/status_macros.h" @@ -141,9 +142,13 @@ void ReusablePool::TrimAvailable( std::vector>* trimmed) { size_t keep = std::max(keep_count_ - in_use_count_, 0); if (available_.size() > keep) { - ABSL_LOG_FIRST_N(WARNING, 1) - << "Maximum number of pooled buffers reached. Consider increasing " - "MultiPoolOptions.keep_count"; + ABSL_LOG_FIRST_N(WARNING, 1) << absl::StrFormat( + "Maximum number of pooled buffers reached (set to keep at most %d " + "buffers of the same type and size). MP buffer allocation patterns can " + "be observed with Perfetto by inspecting the " + "PerfettoScopedMemoryObjectCounters-based GpuBuffer and AhwbBuffer " + "counters. Then consider adjusting the MultiPoolOptions.keep_count", + keep_count_); auto trim_it = std::next(available_.begin(), keep); if (trimmed) { std::move(trim_it, available_.end(), std::back_inserter(*trimmed));