1
0
Эх сурвалжийг харах

UI: Add memory usage to Stats window on linux/mac

Closes jp9000/obs-studio#953
mntone 8 жил өмнө
parent
commit
9ffdaff984

+ 0 - 12
UI/platform-windows.cpp

@@ -30,7 +30,6 @@ using namespace std;
 #include <shellapi.h>
 #include <shlobj.h>
 #include <Dwmapi.h>
-#include <psapi.h>
 #include <mmdeviceapi.h>
 #include <audiopolicy.h>
 
@@ -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;
 

+ 0 - 1
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;
 

+ 1 - 7
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
 
 	/* ------------------ */