diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-02-26 15:40:18 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-08 07:32:15 -0500 |
commit | 33a4fd9939f8fc8e9ba4e61041270353f51ae55e (patch) | |
tree | 8bc3624fc179d11dc68a504646bae97b1ce48dcb /rts/Trace.h | |
parent | 657b5538904f7d9e0b3ea5d84f4017af3c513df9 (diff) | |
download | haskell-33a4fd9939f8fc8e9ba4e61041270353f51ae55e.tar.gz |
eventlog: Add MEM_RETURN event to give information about fragmentation
See #19357
The event reports the
* Current number of megablocks allocated
* The number that the RTS thinks it needs
* The number is managed to return to the OS
When current > need then the difference is returned to the OS, the
successful number of returned mblocks is reported by 'returned'.
In a fragmented heap current > need but returned < current - need.
Diffstat (limited to 'rts/Trace.h')
-rw-r--r-- | rts/Trace.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rts/Trace.h b/rts/Trace.h index f9d677d063..eed362e7b6 100644 --- a/rts/Trace.h +++ b/rts/Trace.h @@ -158,6 +158,11 @@ void traceEventGcStats_ (Capability *cap, W_ par_tot_copied, W_ par_balanced_copied); +void traceEventMemReturn_ (Capability *cap, + uint32_t current_mblocks, + uint32_t needed_mblocks, + uint32_t returned_mblocks ); + /* * Record a spark event */ @@ -339,6 +344,7 @@ void flushTrace(void); copied, slop, fragmentation, \ par_n_threads, par_max_copied, \ par_tot_copied, par_balanced_copied) /* nothing */ +#define traceEventMemReturn_(cap, current, needed, returned) /* nothing */ #define traceHeapEvent(cap, tag, heap_capset, info1) /* nothing */ #define traceEventHeapInfo_(heap_capset, gens, \ maxHeapSize, allocAreaSize, \ @@ -453,6 +459,8 @@ void dtraceUserMarkerWrapper(Capability *cap, char *msg); par_max_copied, \ par_balanced_copied, \ par_tot_copied) +#define dtraceEventMemReturn(current, needed, returned) \ + HASKELLEVENT_MEM_RETURN(current, needed, returned) #define dtraceHeapInfo(heap_capset, gens, \ maxHeapSize, allocAreaSize, \ mblockSize, blockSize) \ @@ -524,6 +532,7 @@ void dtraceUserMarkerWrapper(Capability *cap, char *msg); par_max_copied, \ par_tot_copied, \ par_balanced_copied) /* nothing */ +#define dtraceEventMemReturn(current, needed, returned) /* nothing */ #define dtraceHeapInfo(heap_capset, gens, \ maxHeapSize, allocAreaSize, \ mblockSize, blockSize) /* nothing */ @@ -743,6 +752,17 @@ INLINE_HEADER void traceEventGcStats(Capability *cap STG_UNUSED, par_tot_copied, par_balanced_copied); } +INLINE_HEADER void traceEventMemReturn(Capability *cap STG_UNUSED, + uint32_t current_mblocks STG_UNUSED, + uint32_t needed_mblocks STG_UNUSED, + uint32_t returned_mblocks STG_UNUSED) +{ + if (RTS_UNLIKELY(TRACE_gc)) { + traceEventMemReturn_(cap, current_mblocks, needed_mblocks, returned_mblocks); + } + dtraceEventMemReturn(current_mblocks, needed_mblocks, returned_mblocks); +} + INLINE_HEADER void traceEventHeapInfo(CapsetID heap_capset STG_UNUSED, uint32_t gens STG_UNUSED, W_ maxHeapSize STG_UNUSED, |