| File src/Memory.cpp changed (mode: 100644) (index cab13f3..8d01270) |
| 20 |
20 |
#include <unistd.h> |
#include <unistd.h> |
| 21 |
21 |
|
|
| 22 |
22 |
#include <cassert> |
#include <cassert> |
|
23 |
|
#include <cstdint> |
| 23 |
24 |
|
|
| 24 |
25 |
#include <fstream> |
#include <fstream> |
| 25 |
26 |
#include <limits> |
#include <limits> |
| |
| ... |
... |
int Memory::getMemoryUsage() const |
| 61 |
62 |
return (-1); |
return (-1); |
| 62 |
63 |
} |
} |
| 63 |
64 |
|
|
| 64 |
|
int total, free, avail, buffers, cached; |
|
|
65 |
|
std::uint64_t total, free, avail, buffers, cached; |
| 65 |
66 |
|
|
| 66 |
67 |
meminfo.ignore(std::numeric_limits<std::streamsize>::max(), ':') >> total; |
meminfo.ignore(std::numeric_limits<std::streamsize>::max(), ':') >> total; |
| 67 |
68 |
meminfo.ignore(std::numeric_limits<std::streamsize>::max(), ':') >> free; |
meminfo.ignore(std::numeric_limits<std::streamsize>::max(), ':') >> free; |
| |
| ... |
... |
int Memory::getMemoryUsage() const |
| 71 |
72 |
|
|
| 72 |
73 |
meminfo.close(); |
meminfo.close(); |
| 73 |
74 |
|
|
| 74 |
|
const int usage { |
|
|
75 |
|
const std::uint64_t usage { |
| 75 |
76 |
100 - ((free + buffers + cached)*100)/total |
100 - ((free + buffers + cached)*100)/total |
| 76 |
77 |
}; |
}; |
| 77 |
78 |
|
|