검색결과 리스트
글
GlobalMemoryStatusEx
Programming/C/C++
2014. 6. 22. 12:43
// Use to convert bytes to KB
#define DIV 1024
// Specify the width of the field in which to print the numbers.
// The asterisk in the format specifier "%*I64d" takes an integer
// argument and uses it to pad and right justify the number.
#define WIDTH 7
void _tmain()
{
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
_tprintf (TEXT("There is %*ld percent of memory in use.\n"),
WIDTH, statex.dwMemoryLoad);
_tprintf (TEXT("There are %*I64d total KB of physical memory.\n"),
WIDTH, statex.ullTotalPhys/DIV);
_tprintf (TEXT("There are %*I64d free KB of physical memory.\n"),
WIDTH, statex.ullAvailPhys/DIV);
_tprintf (TEXT("There are %*I64d total KB of paging file.\n"),
WIDTH, statex.ullTotalPageFile/DIV);
_tprintf (TEXT("There are %*I64d free KB of paging file.\n"),
WIDTH, statex.ullAvailPageFile/DIV);
_tprintf (TEXT("There are %*I64d total KB of virtual memory.\n"),
WIDTH, statex.ullTotalVirtual/DIV);
_tprintf (TEXT("There are %*I64d free KB of virtual memory.\n"),
WIDTH, statex.ullAvailVirtual/DIV);
// Show the amount of extended memory available.
_tprintf (TEXT("There are %*I64d free KB of extended memory.\n"),
WIDTH, statex.ullAvailExtendedVirtual/DIV);
}
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx'Programming > C/C++' 카테고리의 다른 글
| Memory Bandwidth (0) | 2014.06.30 |
|---|---|
| 비디오 메모리 구하기 (0) | 2014.06.24 |
| [WinAPI] 컴퓨터 각종 부품 정보 알아내기 (1) | 2014.06.22 |
| stack overrun (0) | 2014.06.19 |
| operator new (0) | 2014.06.14 |