diff options
author | Andy Hanson <anhans@microsoft.com> | 2019-07-08 16:12:06 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-07-08 16:12:06 -0700 |
commit | 11137fbe46f524dfd6c2f7bb2a77035aa225524c (patch) | |
tree | 116160fa9d0ed8c8cb2fa1cb6ac407e476ab96cf /src/gc | |
parent | 8749c016e520bcaa23c56a862fe5f57eba1b879b (diff) | |
download | coreclr-11137fbe46f524dfd6c2f7bb2a77035aa225524c.tar.gz coreclr-11137fbe46f524dfd6c2f7bb2a77035aa225524c.tar.bz2 coreclr-11137fbe46f524dfd6c2f7bb2a77035aa225524c.zip |
Return HardLimitBytes from GCMemoryInfo.TotalAvailableMemoryBytes (#25437)
* Add property HardLimitBytes to GCMemoryInfo
This adds a new property HardLimitBytes.
Unlike TotalAvailableMemoryBytes,
this will reflect an explicitly set COMPLUS_GCHeapHardLimit.
It will also reflect the fraction of a container's size that we use,
where TotalAvailableMemoryBytes is the total container size.
Normally, though, it is equal to TotalAvailableMemoryBytes.
Fix #38821
* Remove HardLimitBytes; have TotalAvailableMemoryBytes take on its behavior
* Fix typos
* Separate total_physical_mem and heap_hard_limit
so we can compute highMemoryLoadThresholdBytes and memoryLoadBytes
* Do more work in gc.cpp instead of Gc.cs
* Consistently end names in "Bytes"
Diffstat (limited to 'src/gc')
-rw-r--r-- | src/gc/gc.cpp | 24 | ||||
-rw-r--r-- | src/gc/gcimpl.h | 11 | ||||
-rw-r--r-- | src/gc/gcinterface.h | 11 |
3 files changed, 25 insertions, 21 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index f4d877fe88..f107b134ca 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -36814,17 +36814,19 @@ unsigned int GCHeap::GetCondemnedGeneration() return gc_heap::settings.condemned_generation; } -void GCHeap::GetMemoryInfo(uint32_t* highMemLoadThreshold, - uint64_t* totalPhysicalMem, - uint32_t* lastRecordedMemLoad, - size_t* lastRecordedHeapSize, - size_t* lastRecordedFragmentation) -{ - *highMemLoadThreshold = gc_heap::high_memory_load_th; - *totalPhysicalMem = gc_heap::total_physical_mem; - *lastRecordedMemLoad = gc_heap::last_gc_memory_load; - *lastRecordedHeapSize = gc_heap::last_gc_heap_size; - *lastRecordedFragmentation = gc_heap::last_gc_fragmentation; +void GCHeap::GetMemoryInfo(uint64_t* highMemLoadThresholdBytes, + uint64_t* totalAvailableMemoryBytes, + uint64_t* lastRecordedMemLoadBytes, + uint32_t* lastRecordedMemLoadPct, + size_t* lastRecordedHeapSizeBytes, + size_t* lastRecordedFragmentationBytes) +{ + *highMemLoadThresholdBytes = (uint64_t) (((double)gc_heap::high_memory_load_th) / 100 * gc_heap::total_physical_mem); + *totalAvailableMemoryBytes = gc_heap::heap_hard_limit != 0 ? gc_heap::heap_hard_limit : gc_heap::total_physical_mem; + *lastRecordedMemLoadBytes = (uint64_t) (((double)gc_heap::last_gc_memory_load) / 100 * gc_heap::total_physical_mem); + *lastRecordedMemLoadPct = gc_heap::last_gc_memory_load; + *lastRecordedHeapSizeBytes = gc_heap::last_gc_heap_size; + *lastRecordedFragmentationBytes = gc_heap::last_gc_fragmentation; } int GCHeap::GetGcLatencyMode() diff --git a/src/gc/gcimpl.h b/src/gc/gcimpl.h index b1d4e07981..965bfa6987 100644 --- a/src/gc/gcimpl.h +++ b/src/gc/gcimpl.h @@ -171,11 +171,12 @@ public: unsigned GetCondemnedGeneration(); - void GetMemoryInfo(uint32_t* highMemLoadThreshold, - uint64_t* totalPhysicalMem, - uint32_t* lastRecordedMemLoad, - size_t* lastRecordedHeapSize, - size_t* lastRecordedFragmentation); + void GetMemoryInfo(uint64_t* highMemLoadThresholdBytes, + uint64_t* totalAvailableMemoryBytes, + uint64_t* lastRecordedMemLoadBytes, + uint32_t* lastRecordedMemLoadPct, + size_t* lastRecordedHeapSizeBytes, + size_t* lastRecordedFragmentationBytes); int GetGcLatencyMode(); int SetGcLatencyMode(int newLatencyMode); diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h index 6d09a62824..062743ff37 100644 --- a/src/gc/gcinterface.h +++ b/src/gc/gcinterface.h @@ -605,11 +605,12 @@ public: // lastRecordedMemLoad - physical memory load in percentage recorded in the last GC // lastRecordedHeapSize - total managed heap size recorded in the last GC // lastRecordedFragmentation - total fragmentation in the managed heap recorded in the last GC - virtual void GetMemoryInfo(uint32_t* highMemLoadThreshold, - uint64_t* totalPhysicalMem, - uint32_t* lastRecordedMemLoad, - size_t* lastRecordedHeapSize, - size_t* lastRecordedFragmentation) = 0; + virtual void GetMemoryInfo(uint64_t* highMemLoadThresholdBytes, + uint64_t* totalPhysicalMemoryBytes, + uint64_t* lastRecordedMemLoadBytes, + uint32_t* lastRecordedMemLoadPct, + size_t* lastRecordedHeapSizeBytes, + size_t* lastRecordedFragmentationBytes) = 0; // Gets the current GC latency mode. virtual int GetGcLatencyMode() = 0; |