diff options
-rw-r--r-- | src/gc/env/gcenv.os.h | 4 | ||||
-rw-r--r-- | src/gc/sample/gcenv.windows.cpp | 22 | ||||
-rw-r--r-- | src/vm/gcenv.os.cpp | 9 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/gc/env/gcenv.os.h b/src/gc/env/gcenv.os.h index 0cdc7a4d16..bb0153f117 100644 --- a/src/gc/env/gcenv.os.h +++ b/src/gc/env/gcenv.os.h @@ -240,9 +240,9 @@ public: // specified, it returns amount of actual physical memory. static uint64_t GetPhysicalMemoryLimit(); - // Get global memory status + // Get memory status // Parameters: - // memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory + // memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory // that is in use (0 indicates no memory use and 100 indicates full memory use). // available_physical - The amount of physical memory currently available, in bytes. // available_page_file - The maximum amount of memory the current process can commit, in bytes. diff --git a/src/gc/sample/gcenv.windows.cpp b/src/gc/sample/gcenv.windows.cpp index e35af6b6a0..76187f2185 100644 --- a/src/gc/sample/gcenv.windows.cpp +++ b/src/gc/sample/gcenv.windows.cpp @@ -13,8 +13,6 @@ #include "gcenv.h" #include "gc.h" -static LARGE_INTEGER performanceFrequency; - MethodTable * g_pFreeObjectMethodTable; int32_t g_TrapReturningThreads; @@ -23,12 +21,14 @@ bool g_fFinalizerRunOnShutDown; GCSystemInfo g_SystemInfo; +static LARGE_INTEGER g_performanceFrequency; + // Initialize the interface implementation // Return: // true if it has succeeded, false if it has failed bool GCToOSInterface::Initialize() { - if (!::QueryPerformanceFrequency(&performanceFrequency)) + if (!::QueryPerformanceFrequency(&g_performanceFrequency)) { return false; } @@ -310,9 +310,12 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit() return memStatus.ullTotalPhys; } -// Get global memory status +// Get memory status // Parameters: -// ms - pointer to the structure that will be filled in with the memory status +// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory +// that is in use (0 indicates no memory use and 100 indicates full memory use). +// available_physical - The amount of physical memory currently available, in bytes. +// available_page_file - The maximum amount of memory the current process can commit, in bytes. void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available_physical, uint64_t* available_page_file) { MEMORYSTATUSEX memStatus; @@ -356,14 +359,7 @@ int64_t GCToOSInterface::QueryPerformanceCounter() // The counter frequency int64_t GCToOSInterface::QueryPerformanceFrequency() { - LARGE_INTEGER frequency; - if (!::QueryPerformanceFrequency(&frequency)) - { - _ASSERTE(!"Fatal Error - cannot query performance counter."); - abort(); - } - - return frequency.QuadPart; + return g_performanceFrequency.QuadPart; } // Get a time stamp with a low precision diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp index 1972b23ea7..73b21a7a0b 100644 --- a/src/vm/gcenv.os.cpp +++ b/src/vm/gcenv.os.cpp @@ -534,9 +534,14 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit() return memStatus.ullTotalPhys; } -// Get global memory status +// Get memory status // Parameters: -// ms - pointer to the structure that will be filled in with the memory status +// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory +// that is in use (0 indicates no memory use and 100 indicates full memory use). +// available_physical - The amount of physical memory currently available, in bytes. +// available_page_file - The maximum amount of memory the current process can commit, in bytes. +// Remarks: +// Any parameter can be null. void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available_physical, uint64_t* available_page_file) { LIMITED_METHOD_CONTRACT; |