Browse Source

debugactor displays memory usage on windows

dmuratshin 9 years ago
parent
commit
558b875ed0
1 changed files with 15 additions and 0 deletions
  1. 15 0
      oxygine/src/DebugActor.cpp

+ 15 - 0
oxygine/src/DebugActor.cpp

@@ -31,6 +31,7 @@
 #include <stdarg.h>
 #include <iomanip>
 
+
 #ifdef __S3E__
 #include "s3eMemory.h"
 #elif __APPLE__
@@ -41,6 +42,13 @@
 #include "SDL_video.h"
 #endif
 
+#ifdef __WIN32__
+#pragma comment(lib, "psapi.lib") // Added to support GetProcessMemoryInfo()
+#include <windows.h>
+#include <Psapi.h>
+#endif
+
+
 namespace oxygine
 {
     Resources* DebugActor::resSystem = 0;
@@ -355,6 +363,13 @@ namespace oxygine
         s << "memory=" << mem / 1024 << "kb ";
 #endif
 
+#ifdef __WIN32__
+        PROCESS_MEMORY_COUNTERS_EX pmc;
+        GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmc, sizeof(pmc));
+        s << "memory=" << pmc.PrivateUsage/ 1024 << "kb ";
+
+#endif
+
         if (!_debugText.empty())
         {
             s << "\n";