From 64815b311e47395638a2bf5ea80f949526942570 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Apr 2016 02:53:46 +0300 Subject: Show counted memory usage sum in chat. --- src/resources/memorymanager.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/resources/memorymanager.cpp') diff --git a/src/resources/memorymanager.cpp b/src/resources/memorymanager.cpp index a88d53b79..ecb0879aa 100644 --- a/src/resources/memorymanager.cpp +++ b/src/resources/memorymanager.cpp @@ -22,8 +22,13 @@ #include "logger.h" +#include "gui/widgets/tabs/chat/chattab.h" + #include "resources/resourcemanager.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + #include #include @@ -62,10 +67,19 @@ void MemoryManager::printMemory(const int level A_UNUSED, childsSum); } -void MemoryManager::printAllMemory() +void MemoryManager::printAllMemory(ChatTab *const tab A_DYECMD_UNUSED) { if (!logger) return; + int sz = 0; if (resourceManager) - resourceManager->calcMemory(0); + sz += resourceManager->calcMemory(0); +#ifndef DYECMD + if (tab) + { + // TRANSLATORS: memory usage chat message + tab->chatLog(strprintf(_("Calculated memory usage: %d"), sz), + ChatMsgType::BY_SERVER); + } +#endif } -- cgit v1.2.3-70-g09d2