summaryrefslogtreecommitdiff
path: root/src/resources/memorymanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-26 22:45:55 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-26 22:45:55 +0300
commit80bbbc4c18273e0d1116d7e924d1df068a5d63d5 (patch)
treebef2f6458ee7fc5079c1993921abdfc4926570bb /src/resources/memorymanager.cpp
parent918e2a5cf24311e87b0dc754770480727f77eac3 (diff)
downloadplus-80bbbc4c18273e0d1116d7e924d1df068a5d63d5.tar.gz
plus-80bbbc4c18273e0d1116d7e924d1df068a5d63d5.tar.bz2
plus-80bbbc4c18273e0d1116d7e924d1df068a5d63d5.tar.xz
plus-80bbbc4c18273e0d1116d7e924d1df068a5d63d5.zip
Add chat command for print memory usage. For now only report about resources.
New chat command: /dumpmemoryusage
Diffstat (limited to 'src/resources/memorymanager.cpp')
-rw-r--r--src/resources/memorymanager.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/resources/memorymanager.cpp b/src/resources/memorymanager.cpp
index a07aaa750..a88d53b79 100644
--- a/src/resources/memorymanager.cpp
+++ b/src/resources/memorymanager.cpp
@@ -20,7 +20,12 @@
#include "resources/memorymanager.h"
+#include "logger.h"
+
+#include "resources/resourcemanager.h"
+
#include <SDL_video.h>
+#include <string>
#include "debug.h"
@@ -49,4 +54,18 @@ void MemoryManager::printMemory(const int level A_UNUSED,
const int localSum A_UNUSED,
const int childsSum A_UNUSED)
{
+ std::string str(level, ' ');
+ logger->log("%s%d = %d + %d",
+ str.c_str(),
+ localSum + childsSum,
+ localSum,
+ childsSum);
+}
+
+void MemoryManager::printAllMemory()
+{
+ if (!logger)
+ return;
+ if (resourceManager)
+ resourceManager->calcMemory(0);
}