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

Closes jp9000/obs-studio#953
master
mntone 2017-09-12 00:24:35 -07:00 committed by jp9000
parent a6318ffdca
commit 9ffdaff984
3 changed files with 1 additions and 20 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
/* ------------------ */