From 9ffdaff984071d812ea8d69ed85f3aedf2342ff9 Mon Sep 17 00:00:00 2001 From: mntone Date: Tue, 12 Sep 2017 00:24:35 -0700 Subject: [PATCH] UI: Add memory usage to Stats window on linux/mac Closes jp9000/obs-studio#953 --- UI/platform-windows.cpp | 12 ------------ UI/platform.hpp | 1 - UI/window-basic-stats.cpp | 8 +------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/UI/platform-windows.cpp b/UI/platform-windows.cpp index 1ca22abfb..90740187a 100644 --- a/UI/platform-windows.cpp +++ b/UI/platform-windows.cpp @@ -30,7 +30,6 @@ using namespace std; #include #include #include -#include #include #include @@ -264,17 +263,6 @@ bool DisableAudioDucking(bool disable) return SUCCEEDED(result); } -uint64_t CurrentMemoryUsage() -{ - PROCESS_MEMORY_COUNTERS pmc = {}; - pmc.cb = sizeof(pmc); - - if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) - return 0; - - return (uint64_t)pmc.WorkingSetSize; -} - struct RunOnceMutexData { WinHandle handle; diff --git a/UI/platform.hpp b/UI/platform.hpp index ca0780b48..5011e6050 100644 --- a/UI/platform.hpp +++ b/UI/platform.hpp @@ -43,7 +43,6 @@ void SetAeroEnabled(bool enable); void SetProcessPriority(const char *priority); void SetWin32DropStyle(QWidget *window); bool DisableAudioDucking(bool disable); -uint64_t CurrentMemoryUsage(); struct RunOnceMutexData; diff --git a/UI/window-basic-stats.cpp b/UI/window-basic-stats.cpp index 0e61e27a6..2a66c2d41 100644 --- a/UI/window-basic-stats.cpp +++ b/UI/window-basic-stats.cpp @@ -57,15 +57,11 @@ OBSBasicStats::OBSBasicStats(QWidget *parent) cpuUsage = new QLabel(this); hddSpace = new QLabel(this); -#ifdef _WIN32 memUsage = new QLabel(this); -#endif newStat("CPUUsage", cpuUsage, 0); newStat("HDDSpaceAvailable", hddSpace, 0); -#ifdef _WIN32 newStat("MemoryUsage", memUsage, 0); -#endif fps = new QLabel(this); renderTime = new QLabel(this); @@ -300,12 +296,10 @@ void OBSBasicStats::Update() /* ------------------ */ -#ifdef _WIN32 - num = (long double)CurrentMemoryUsage() / (1024.0l * 1024.0l); + num = (long double)os_get_proc_resident_size() / (1024.0l * 1024.0l); str = QString::number(num, 'f', 1) + QStringLiteral(" MB"); memUsage->setText(str); -#endif /* ------------------ */