-
Notifications
You must be signed in to change notification settings - Fork 0
/
Source.cpp
40 lines (34 loc) · 1.59 KB
/
Source.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
#include <Windows.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <WinBase.h>
#include <Psapi.h>
int main(){
while (1){
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
PERFORMANCE_INFORMATION perfInfo;
GetPerformanceInfo(&perfInfo, sizeof(perfInfo));
MEMORYSTATUSEX succInfo;
//succInfo = new MEMORYSTATUSEX(); //(MEMORYSTATUSEX *)malloc(sizeof(MEMORYSTATUSEX));
succInfo.dwLength = sizeof(succInfo);
if (!GlobalMemoryStatusEx(&succInfo)){
printf("Eroare!\n");
printf("%d\n", GetLastError());
system("pause");
exit(1);
}
printf("Dimensiunea paginii de memorie: %d B\n", sysInfo.dwPageSize);
printf("Adresa Minima: %d\n", sysInfo.lpMinimumApplicationAddress);
printf("Adresa maxima: %d\n", sysInfo.lpMaximumApplicationAddress);
printf("Total physical memory: %f GB\n", ((float)perfInfo.PhysicalTotal * (float)sysInfo.dwPageSize) / (1024.00*1024.00*1024.00));
printf("Available physical memory : %f GB\n", ((float)perfInfo.PhysicalAvailable * (float)sysInfo.dwPageSize) / (1024.00*1024.00*1024.00));
printf("Spatiu de memoria alocat SO-ului : %f GB\n", ((float)perfInfo.KernelTotal * (float)sysInfo.dwPageSize) / (1024.00*1024.00*1024.00));
printf("Spatiul total de memorie virtuala alocat procesului : %d B\n", succInfo.ullTotalVirtual);
printf("Spatiul disponibil de memorie virtuala alocat procesului : %f GB\n", (((float)succInfo.ullAvailVirtual) / (1024.00*1024.00*1024.00)));
printf("Gradul de ocupare al memoriei: %Lf %%\n", (long double)succInfo.dwMemoryLoad);
system("@cls||clear");
}
return 0;
}