13
13
#include " gcenv.h"
14
14
#include " gc.h"
15
15
16
- static LARGE_INTEGER performanceFrequency;
17
-
18
16
MethodTable * g_pFreeObjectMethodTable;
19
17
20
18
int32_t g_TrapReturningThreads;
@@ -23,12 +21,14 @@ bool g_fFinalizerRunOnShutDown;
23
21
24
22
GCSystemInfo g_SystemInfo;
25
23
24
+ static LARGE_INTEGER g_performanceFrequency;
25
+
26
26
// Initialize the interface implementation
27
27
// Return:
28
28
// true if it has succeeded, false if it has failed
29
29
bool GCToOSInterface::Initialize ()
30
30
{
31
- if (!::QueryPerformanceFrequency (&performanceFrequency ))
31
+ if (!::QueryPerformanceFrequency (&g_performanceFrequency ))
32
32
{
33
33
return false ;
34
34
}
@@ -310,9 +310,12 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit()
310
310
return memStatus.ullTotalPhys ;
311
311
}
312
312
313
- // Get global memory status
313
+ // Get memory status
314
314
// Parameters:
315
- // ms - pointer to the structure that will be filled in with the memory status
315
+ // memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory
316
+ // that is in use (0 indicates no memory use and 100 indicates full memory use).
317
+ // available_physical - The amount of physical memory currently available, in bytes.
318
+ // available_page_file - The maximum amount of memory the current process can commit, in bytes.
316
319
void GCToOSInterface::GetMemoryStatus (uint32_t * memory_load, uint64_t * available_physical, uint64_t * available_page_file)
317
320
{
318
321
MEMORYSTATUSEX memStatus;
@@ -356,14 +359,7 @@ int64_t GCToOSInterface::QueryPerformanceCounter()
356
359
// The counter frequency
357
360
int64_t GCToOSInterface::QueryPerformanceFrequency ()
358
361
{
359
- LARGE_INTEGER frequency;
360
- if (!::QueryPerformanceFrequency (&frequency))
361
- {
362
- _ASSERTE (!" Fatal Error - cannot query performance counter." );
363
- abort ();
364
- }
365
-
366
- return frequency.QuadPart ;
362
+ return g_performanceFrequency.QuadPart ;
367
363
}
368
364
369
365
// Get a time stamp with a low precision
0 commit comments