File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 26
26
void
27
27
MM_AllocationStats::clear ()
28
28
{
29
+ /* calculate cumulative stats before any clear */
30
+ _allocationBytesCumulative += bytesAllocated ();
31
+
32
+
29
33
#if defined(OMR_GC_THREAD_LOCAL_HEAP)
30
34
_tlhRefreshCountFresh = 0 ;
31
35
_tlhRefreshCountReused = 0 ;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class MM_AllocationStats : public MM_Base
49
49
50
50
uintptr_t _allocationCount;
51
51
uintptr_t _allocationBytes;
52
+ uintptr_t _allocationBytesCumulative; /* *< cumulative allocation up to last clear, excluding since last clear */
52
53
uintptr_t _ownableSynchronizerObjectCount; /* *< Number of Ownable Synchronizer Object allocations */
53
54
uintptr_t _continuationObjectCount; /* *< Number of Continuation Object allocations */
54
55
uintptr_t _discardedBytes;
@@ -86,6 +87,18 @@ class MM_AllocationStats : public MM_Base
86
87
return totalBytesAllocated;
87
88
}
88
89
90
+ bool bytesAllocatedCumulative (uintptr_t *cumulativeValue) {
91
+ if (NULL != cumulativeValue) {
92
+ /* sum the values up to last clear and since last clear */
93
+ *cumulativeValue = _allocationBytesCumulative + bytesAllocated ();
94
+
95
+ /* return false if overflowing */
96
+ return (_allocationBytesCumulative <= *cumulativeValue);
97
+ }
98
+
99
+ return false ;
100
+ }
101
+
89
102
MM_AllocationStats () :
90
103
#if defined(OMR_GC_THREAD_LOCAL_HEAP)
91
104
_tlhRefreshCountFresh (0 ),
You can’t perform that action at this time.
0 commit comments