-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.cpp
42 lines (25 loc) · 825 Bytes
/
main.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
#include <iostream>
#include <thread>
#include "ProcessInfo.h"
#include "SystemInformation.h"
int main() {
std::thread th([](){
while (true){
auto i = 1223 * 1453;
}
});
ProcessInfo process;
SystemInformation sys_info;
auto memory = process.GetMemoryUsage();
auto max_memory = sys_info.GetTotalMemory();
auto mem_usage = sys_info.GetTotalUsageMemory();
for (int i = 0; i < 1000; i++) {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
// auto cpu_usage1 = get_cpu_usage(_pid);
auto cpu_usage = process.GetCpuUsage();
auto cpu_sys_usage = sys_info.GetCpuTotalUsage();
printf("devenv.exe: %.2f%%\n", cpu_usage);
std::cout << "cpu -> " << cpu_sys_usage << std::endl;
}
return 0;
}