-
Notifications
You must be signed in to change notification settings - Fork 0
/
Memory.cpp
52 lines (36 loc) · 1.32 KB
/
Memory.cpp
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
43
44
45
46
47
48
49
50
51
52
#include "Memory.hpp"
Memory::Memory() {}
Memory::~Memory() {}
Memory::Memory(Memory const &src) {
*this = src;
}
Memory& Memory::operator=(Memory const &src) {
_title = src._title;
return *this;
}
void Memory::draw() {
}
SDL_Surface * Memory::getSurfaceTotal() {
return getSurface("Total: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 2"));
}
SDL_Surface * Memory::getSurfaceResident() {
return getSurface("Resident: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 4"));
}
SDL_Surface * Memory::getSurfacePrivate() {
return getSurface("Private: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 6"));
}
SDL_Surface * Memory::getSurfaceShared() {
return getSurface("Shared: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 8"));
}
std::string Memory::getTotal() {
return ("Total: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 2"));
}
std::string Memory::getResident() {
return ("Resident: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 4"));
}
std::string Memory::getPrivate() {
return ("Private: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 6"));
}
std::string Memory::getShared() {
return ("Shared: " + getCommand("top -l1 -n1 | grep 'MemRegions:' | cut -d ' ' -f 8"));
}