From 40a8f0b6eb66bae93f8708dd84aaec57f7505c05 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 22 Jun 2018 07:20:24 -0400 Subject: Forward port to nightly-2018-06-22. --- examples/dhtd.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'examples') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 6ef4539f..628a58bd 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -485,9 +485,34 @@ clientSession s@Session{..} sock cnum h = do "gc" -> do hPutClient h "Performing garbage collection..." performMajorGC "" -> do +#if MIN_VERSION_base(4,11,1) + is_enabled <- getRTSStatsEnabled +#else is_enabled <- getGCStatsEnabled +#endif if is_enabled then do +#if MIN_VERSION_base(4,11,1) + RTSStats{..} <- getRTSStats + let r = [ ("bytesAllocated", show allocated_bytes) + , ("numGcs", show gcs) + , ("maxBytesUsed", show max_live_bytes) + --, ("numByteUsageSamples", show numByteUsageSamples) + , ("cumulativeBytesUsed", show cumulative_live_bytes) + , ("bytesCopied", show copied_bytes) + , ("currentBytesUsed", show allocated_bytes) + --, ("currentBytesSlop", show currentBytesSlop) + , ("maxBytesSlop", show max_slop_bytes) + -- , ("peakMegabytesAllocated", show peakMegabytesAllocated) + , ("mutatorCpuNanoseconds", show mutator_cpu_ns) + , ("mutatorWallNanoseconds", show mutator_elapsed_ns) + , ("gcCpuSeconds", show gc_cpu_ns) + , ("gcWallSeconds", show gc_elapsed_ns) + , ("cpuSeconds", show cpu_ns) + , ("wallSeconds", show elapsed_ns) + , ("parTotBytesCopied", show par_copied_bytes) + , ("parMaxBytesCopied", show cumulative_par_max_copied_bytes) +#else GCStats{..} <- getGCStats let r = [ ("bytesAllocated", show bytesAllocated) , ("numGcs", show numGcs) @@ -507,6 +532,7 @@ clientSession s@Session{..} sock cnum h = do , ("wallSeconds", show wallSeconds) , ("parTotBytesCopied", show parTotBytesCopied) , ("parMaxBytesCopied", show parMaxBytesCopied) +#endif ] hPutClient h $ showReport r else hPutClient h "Run with +RTS -T to obtain live memory-usage information." -- cgit v1.2.3