VirtualBox

Ignore:
Timestamp:
May 30, 2013 9:22:00 AM (12 years ago)
Author:
vboxsync
Message:

Main/PerformanceWin: call RTSystemQueryTotalRam() only once

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/win/PerformanceWin.cpp

    r44529 r46319  
    8989    PFNNQSI mpfnNtQuerySystemInformation;
    9090    HMODULE mhNtDll;
     91
     92    ULONG totalRAM;
    9193};
    9294
     
    119121        }
    120122    }
     123
     124    uint64_t cb;
     125    int rc = RTSystemQueryTotalRam(&cb);
     126    if (RT_FAILURE(rc))
     127        totalRAM = 0;
     128    else
     129        totalRAM = (ULONG)(cb / 1024);
    121130}
    122131
     
    303312{
    304313    uint64_t cb;
    305     int rc = RTSystemQueryTotalRam(&cb);
     314    rc = RTSystemQueryAvailableRam(&cb);
    306315    if (RT_SUCCESS(rc))
    307316    {
    308         *total = (ULONG)(cb / 1024);
    309         rc = RTSystemQueryAvailableRam(&cb);
    310         if (RT_SUCCESS(rc))
    311         {
    312             *available = (ULONG)(cb / 1024);
    313             *used = *total - *available;
    314         }
     317        *total = totalRAM;
     318        *available = (ULONG)(cb / 1024);
     319        *used = *total - *available;
    315320    }
    316321    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette