I want to calculate total physical memory usage of system. This is my code:
float totalmem(){
    DWORDLONG totalVirtualMem;
    MEMORYSTATUSEX memInfo;
    float virtualMemUsed;
    memInfo.dwLength = sizeof(MEMORYSTATUSEX);
    GlobalMemoryStatusEx(&memInfo);
    totalVirtualMem = memInfo.ullTotalPageFile;
    virtualMemUsed = (double) (memInfo.ullTotalPageFile - memInfo.ullAvailPageFile) / memInfo.ullTotalPageFile * 100;
    return virtualMemUsed;
}
But the answer is different from that windows task manager or process explorer shows. What's wrong with my code?
 
    