diff options
author | Maoni Stephens <Maoni0@users.noreply.github.com> | 2018-04-02 11:10:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 11:10:48 -0700 |
commit | 2583ce936776a0eac31df904e41d5119840c203b (patch) | |
tree | 987571beacb459f7e7fa9ad79cb0d0c013068cc1 /src/vm | |
parent | 73fe1a9b6dd1983e35093139bf50ede2b78bbf14 (diff) | |
download | coreclr-2583ce936776a0eac31df904e41d5119840c203b.tar.gz coreclr-2583ce936776a0eac31df904e41d5119840c203b.tar.bz2 coreclr-2583ce936776a0eac31df904e41d5119840c203b.zip |
Added a new API to provide memory information that GC records. This (#17326)
is to be used by BCL for deciding when to trim memory usage in pooling code
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/comutilnative.cpp | 12 | ||||
-rw-r--r-- | src/vm/comutilnative.h | 1 | ||||
-rw-r--r-- | src/vm/ecalllist.h | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp index 48efc11904..d564f9acd8 100644 --- a/src/vm/comutilnative.cpp +++ b/src/vm/comutilnative.cpp @@ -922,6 +922,18 @@ UINT64 GCInterface::m_remPressure[NEW_PRESSURE_COUNT] = {0, 0, 0, 0}; // his // (m_iteration % NEW_PRESSURE_COUNT) is used as an index into m_addPressure and m_remPressure UINT GCInterface::m_iteration = 0; +FCIMPL5(void, GCInterface::GetMemoryInfo, UINT32* highMemLoadThreshold, UINT64* totalPhysicalMem, UINT32* lastRecordedMemLoad, size_t* lastRecordedHeapSize, size_t* lastRecordedFragmentation) +{ + FCALL_CONTRACT; + + FC_GC_POLL_NOT_NEEDED(); + + return GCHeapUtilities::GetGCHeap()->GetMemoryInfo(highMemLoadThreshold, totalPhysicalMem, + lastRecordedMemLoad, + lastRecordedHeapSize, lastRecordedFragmentation); +} +FCIMPLEND + FCIMPL0(int, GCInterface::GetGcLatencyMode) { FCALL_CONTRACT; diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h index 3e63a0479c..c604811c9e 100644 --- a/src/vm/comutilnative.h +++ b/src/vm/comutilnative.h @@ -111,6 +111,7 @@ public: static FORCEINLINE UINT64 InterlockedAdd(UINT64 *pAugend, UINT64 addend); static FORCEINLINE UINT64 InterlockedSub(UINT64 *pMinuend, UINT64 subtrahend); + static FCDECL5(void, GetMemoryInfo, UINT32* highMemLoadThreshold, UINT64* totalPhysicalMem, UINT32* lastRecordedMemLoad, size_t* lastRecordedHeapSize, size_t* lastRecordedFragmentation); static FCDECL0(int, GetGcLatencyMode); static FCDECL1(int, SetGcLatencyMode, int newLatencyMode); static FCDECL0(int, GetLOHCompactionMode); diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 92d75e3f90..998f62b908 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -840,6 +840,7 @@ FCFuncStart(gGCInterfaceFuncs) FCFuncElement("_WaitForFullGCApproach", GCInterface::WaitForFullGCApproach) FCFuncElement("_WaitForFullGCComplete", GCInterface::WaitForFullGCComplete) FCFuncElement("_CollectionCount", GCInterface::CollectionCount) + FCFuncElement("GetMemoryInfo", GCInterface::GetMemoryInfo) FCFuncElement("GetGCLatencyMode", GCInterface::GetGcLatencyMode) FCFuncElement("SetGCLatencyMode", GCInterface::SetGcLatencyMode) FCFuncElement("GetLOHCompactionMode", GCInterface::GetLOHCompactionMode) |