-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemoryusage.h
More file actions
43 lines (31 loc) · 731 Bytes
/
memoryusage.h
File metadata and controls
43 lines (31 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef MEMORYUSAGE
#define MEMORYUSAGE
#include <QObject>
// =========== WINDOWS ===========
#if defined(Q_OS_WIN)
#include <windows.h>
struct MemoryUsage
{
MEMORYSTATUSEX m_statex;
MemoryUsage();
double getMemoryUsed_inPercent();
};
#endif
// =========== LINUX ===========
#if defined(Q_OS_LINUX)
#include <QFile>
#include <QRegularExpression>
#define BUFFER_SIZE 512
struct MemoryUsage
{
bool m_availableMemory = true;
QFile procMemInfoFile;
char* bytes = nullptr;
~MemoryUsage();
MemoryUsage();
void setAvailableMemory( bool availableMemory);
long long getValueFromBuffer( int& found, QString& readLine);
double getMemoryUsed_inPercent();
};
#endif
#endif // MEMORYUSAGE