summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-27 02:53:46 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-27 02:53:46 +0300
commit64815b311e47395638a2bf5ea80f949526942570 (patch)
tree11d17054a6fbd8a779321d3bb0f1298144af248f /src/resources
parent80bbbc4c18273e0d1116d7e924d1df068a5d63d5 (diff)
downloadmanaverse-64815b311e47395638a2bf5ea80f949526942570.tar.gz
manaverse-64815b311e47395638a2bf5ea80f949526942570.tar.bz2
manaverse-64815b311e47395638a2bf5ea80f949526942570.tar.xz
manaverse-64815b311e47395638a2bf5ea80f949526942570.zip
Show counted memory usage sum in chat.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/memorymanager.cpp18
-rw-r--r--src/resources/memorymanager.h4
2 files changed, 19 insertions, 3 deletions
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 <SDL_video.h>
#include <string>
@@ -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
}
diff --git a/src/resources/memorymanager.h b/src/resources/memorymanager.h
index 658876776..9243989d3 100644
--- a/src/resources/memorymanager.h
+++ b/src/resources/memorymanager.h
@@ -23,6 +23,8 @@
#include "localconsts.h"
+class ChatTab;
+
struct SDL_Surface;
class MemoryManager final
@@ -41,7 +43,7 @@ class MemoryManager final
const int localSum,
const int childsSum);
- void printAllMemory();
+ void printAllMemory(ChatTab *const tab);
};
extern MemoryManager memoryManager;