summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-22 07:20:24 -0400
committerjoe <joe@jerkface.net>2018-06-22 07:22:33 -0400
commit40a8f0b6eb66bae93f8708dd84aaec57f7505c05 (patch)
treee328f56dd88433a00814452e60ead88acfe13f3b /examples
parent6bbc15735f6e28740c0e05fc8219fd83a5a464a4 (diff)
Forward port to nightly-2018-06-22.
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs26
1 files changed, 26 insertions, 0 deletions
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
485 "gc" -> do hPutClient h "Performing garbage collection..." 485 "gc" -> do hPutClient h "Performing garbage collection..."
486 performMajorGC 486 performMajorGC
487 "" -> do 487 "" -> do
488#if MIN_VERSION_base(4,11,1)
489 is_enabled <- getRTSStatsEnabled
490#else
488 is_enabled <- getGCStatsEnabled 491 is_enabled <- getGCStatsEnabled
492#endif
489 if is_enabled 493 if is_enabled
490 then do 494 then do
495#if MIN_VERSION_base(4,11,1)
496 RTSStats{..} <- getRTSStats
497 let r = [ ("bytesAllocated", show allocated_bytes)
498 , ("numGcs", show gcs)
499 , ("maxBytesUsed", show max_live_bytes)
500 --, ("numByteUsageSamples", show numByteUsageSamples)
501 , ("cumulativeBytesUsed", show cumulative_live_bytes)
502 , ("bytesCopied", show copied_bytes)
503 , ("currentBytesUsed", show allocated_bytes)
504 --, ("currentBytesSlop", show currentBytesSlop)
505 , ("maxBytesSlop", show max_slop_bytes)
506 -- , ("peakMegabytesAllocated", show peakMegabytesAllocated)
507 , ("mutatorCpuNanoseconds", show mutator_cpu_ns)
508 , ("mutatorWallNanoseconds", show mutator_elapsed_ns)
509 , ("gcCpuSeconds", show gc_cpu_ns)
510 , ("gcWallSeconds", show gc_elapsed_ns)
511 , ("cpuSeconds", show cpu_ns)
512 , ("wallSeconds", show elapsed_ns)
513 , ("parTotBytesCopied", show par_copied_bytes)
514 , ("parMaxBytesCopied", show cumulative_par_max_copied_bytes)
515#else
491 GCStats{..} <- getGCStats 516 GCStats{..} <- getGCStats
492 let r = [ ("bytesAllocated", show bytesAllocated) 517 let r = [ ("bytesAllocated", show bytesAllocated)
493 , ("numGcs", show numGcs) 518 , ("numGcs", show numGcs)
@@ -507,6 +532,7 @@ clientSession s@Session{..} sock cnum h = do
507 , ("wallSeconds", show wallSeconds) 532 , ("wallSeconds", show wallSeconds)
508 , ("parTotBytesCopied", show parTotBytesCopied) 533 , ("parTotBytesCopied", show parTotBytesCopied)
509 , ("parMaxBytesCopied", show parMaxBytesCopied) 534 , ("parMaxBytesCopied", show parMaxBytesCopied)
535#endif
510 ] 536 ]
511 hPutClient h $ showReport r 537 hPutClient h $ showReport r
512 else hPutClient h "Run with +RTS -T to obtain live memory-usage information." 538 else hPutClient h "Run with +RTS -T to obtain live memory-usage information."