diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 26 |
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." |