瀏覽代碼

debugactor displays memory usage on windows

dmuratshin 9 年之前
父節點
當前提交
558b875ed0
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      oxygine/src/DebugActor.cpp

+ 15 - 0
oxygine/src/DebugActor.cpp

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