#include "windows.h"
#include "stdio.h"
#include "psapi.h"
#pragma comment(lib, "strmiids.lib")
#pragma comment(lib, "psapi.lib")
int main(int argc, char *argv[]) {
PROCESS_MEMORY_COUNTERS pmc;
/*
your code here
*/
GetProcessMemoryInfo( GetCurrentProcess(), &pmc, sizeof(pmc)); //get memory usage
cout <<"memory usage:" << pmc.PeakWorkingSetSize << endl; //unit in bytes
}
#pragma comment(lib, "psapi.lib")
int main(int argc, char *argv[]) {
PROCESS_MEMORY_COUNTERS pmc;
/*
your code here
*/
GetProcessMemoryInfo( GetCurrentProcess(), &pmc, sizeof(pmc)); //get memory usage
cout <<"memory usage:" << pmc.PeakWorkingSetSize << endl; //unit in bytes
}
沒有留言:
張貼留言