From abf3b03d70dac152a01e5ebb8338d59df7b0bfff Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 3 Jul 2022 10:07:43 +0200 Subject: [PATCH] log buffers --- src/Hyprpaper.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index dd80407..817b891 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -104,6 +104,8 @@ SMonitor* CHyprpaper::getMonitorFromName(const std::string& monname) { } void CHyprpaper::ensurePoolBuffersPresent() { + bool anyNewBuffers = false; + for (auto&[file, wt] : m_mWallpaperTargets) { for (auto& m : m_vMonitors) { @@ -121,9 +123,23 @@ void CHyprpaper::ensurePoolBuffersPresent() { createBuffer(PBUFFER, m->size.x * m->scale, m->size.y * m->scale, WL_SHM_FORMAT_ARGB8888); PBUFFER->pTarget = &wt; + + Debug::log(LOG, "Buffer created, Shared Memory usage: %.1fMB", PBUFFER->size / 1000000.f); + + anyNewBuffers = true; } } } + + if (anyNewBuffers) { + uint64_t bytesUsed = 0; + + for (auto& bf : m_vBuffers) { + bytesUsed += bf->size; + } + + Debug::log(LOG, "Total SM usage for all buffers: %.1fMB", bytesUsed / 1000000.f); + } } void CHyprpaper::clearWallpaperFromMonitor(const std::string& monname) {