@@ -332,9 +332,6 @@ createDistribution name store = do
332332-- function.
333333
334334#if MIN_VERSION_base(4,10,0)
335- -- | Convert nanoseconds to milliseconds.
336- nsToMs :: Int64 -> Int64
337- nsToMs s = round (realToFrac s / (1000000.0 :: Double ))
338335#else
339336-- | Convert seconds to milliseconds.
340337sToMs :: Double -> Int64
@@ -355,101 +352,91 @@ sToMs s = round (s * 1000.0)
355352-- The runtime overhead of @-T@ is very small so it's safe to always
356353-- leave it enabled.
357354--
358- -- Registered counters:
359- --
360- -- [@rts.gc.bytes_allocated@] Total number of bytes allocated
361- --
362- -- [@rts.gc.num_gcs@] Number of garbage collections performed
363- --
364- -- [@rts.gc.num_bytes_usage_samples@] Number of byte usage samples taken
365- --
366- -- [@rts.gc.cumulative_bytes_used@] Sum of all byte usage samples, can be
367- -- used with @numByteUsageSamples@ to calculate averages with
368- -- arbitrary weighting (if you are sampling this record multiple
369- -- times).
370- --
371- -- [@rts.gc.bytes_copied@] Number of bytes copied during GC
372- --
373- -- [@rts.gc.init_cpu_ms@] CPU time used by the init phase, in
374- -- milliseconds. GHC 8.6+ only.
375- --
376- -- [@rts.gc.init_wall_ms@] Wall clock time spent running the init
377- -- phase, in milliseconds. GHC 8.6+ only.
378- --
379- -- [@rts.gc.mutator_cpu_ms@] CPU time spent running mutator threads,
380- -- in milliseconds. This does not include any profiling overhead or
381- -- initialization.
382- --
383- -- [@rts.gc.mutator_wall_ms@] Wall clock time spent running mutator
384- -- threads, in milliseconds. This does not include initialization.
385- --
386- -- [@rts.gc.gc_cpu_ms@] CPU time spent running GC, in milliseconds.
387- --
388- -- [@rts.gc.gc_wall_ms@] Wall clock time spent running GC, in
389- -- milliseconds.
390- --
391- -- [@rts.gc.cpu_ms@] Total CPU time elapsed since program start, in
392- -- milliseconds.
393- --
394- -- [@rts.gc.wall_ms@] Total wall clock time elapsed since start, in
395- -- milliseconds.
396- --
397- -- Registered gauges:
398- --
399- -- [@rts.gc.max_bytes_used@] Maximum number of live bytes seen so far
400- --
401- -- [@rts.gc.current_bytes_used@] Current number of live bytes
402- --
403- -- [@rts.gc.current_bytes_slop@] Current number of bytes lost to slop
404- --
405- -- [@rts.gc.max_bytes_slop@] Maximum number of bytes lost to slop at any one time so far
406- --
407- -- [@rts.gc.peak_megabytes_allocated@] Maximum number of megabytes allocated
408- --
409- -- [@rts.gc.par_tot_bytes_copied@] Number of bytes copied during GC, minus
410- -- space held by mutable lists held by the capabilities. Can be used
411- -- with 'parMaxBytesCopied' to determine how well parallel GC utilized
412- -- all cores.
413- --
414- -- [@rts.gc.par_avg_bytes_copied@] Deprecated alias for
415- -- @par_tot_bytes_copied@.
416- --
417- -- [@rts.gc.par_max_bytes_copied@] Sum of number of bytes copied each GC by
418- -- the most active GC thread each GC. The ratio of
419- -- @par_tot_bytes_copied@ divided by @par_max_bytes_copied@ approaches
420- -- 1 for a maximally sequential run and approaches the number of
421- -- threads (set by the RTS flag @-N@) for a maximally parallel run.
355+ -- Registered counters (see "GHC.Stats" for their meanings:
356+ --
357+ -- > rts.gcs
358+ -- > rts.major_gcs
359+ -- > rts.allocated_bytes
360+ -- > rts.max_live_bytes
361+ -- > rts.max_large_objects_bytes
362+ -- > rts.max_compact_bytes
363+ -- > rts.max_slop_bytes
364+ -- > rts.max_mem_in_use_bytes
365+ -- > rts.cumulative_live_bytes
366+ -- > rts.copied_bytes
367+ -- > rts.par_copied_bytes
368+ -- > rts.cumulative_par_max_copied_bytes
369+ -- > rts.cumulative_par_balanced_copied_bytes
370+ -- > rts.init_cpu_ns
371+ -- > rts.init_elapsed_ns
372+ -- > rts.mutator_cpu_ns
373+ -- > rts.mutator_elapsed_ns
374+ -- > rts.gc_cpu_ns
375+ -- > rts.gc_elapsed_ns
376+ -- > rts.cpu_ns
377+ -- > rts.elapsed_ns
378+ -- > rts.gc.gen
379+ -- > rts.gc.threads
380+ -- > rts.gc.allocated_bytes
381+ -- > rts.gc.live_bytes
382+ -- > rts.gc.large_objects_bytes
383+ -- > rts.gc.compact_bytes
384+ -- > rts.gc.slop_bytes
385+ -- > rts.gc.mem_in_use_bytes
386+ -- > rts.gc.copied_bytes
387+ -- > rts.gc.par_max_copied_bytes
388+ -- > rts.gc.sync_elapsed_ns
389+ -- > rts.gc.cpu_ns
390+ -- > rts.gc.elapsed_ns
422391registerGcMetrics :: Store -> IO ()
423392registerGcMetrics store =
424393 registerGroup
425394#if MIN_VERSION_base(4,10,0)
426395 (M. fromList
427- [ (" rts.gc.bytes_allocated" , Counter . fromIntegral . Stats. allocated_bytes)
428- , (" rts.gc.num_gcs" , Counter . fromIntegral . Stats. gcs)
429- , (" rts.gc.num_bytes_usage_samples" , Counter . fromIntegral . Stats. major_gcs)
430- , (" rts.gc.cumulative_bytes_used" , Counter . fromIntegral . Stats. cumulative_live_bytes)
431- , (" rts.gc.bytes_copied" , Counter . fromIntegral . Stats. copied_bytes)
396+ -- We order them the same way as they are in GHC.Stats for easy comparison.
397+ [ (" rts.gcs" , Counter . fromIntegral . Stats. gcs)
398+ , (" rts.major_gcs" , Counter . fromIntegral . Stats. major_gcs)
399+ , (" rts.allocated_bytes" , Counter . fromIntegral . Stats. allocated_bytes)
400+ , (" rts.max_live_bytes" , Gauge . fromIntegral . Stats. max_live_bytes)
401+ , (" rts.max_large_objects_bytes" , Gauge . fromIntegral . Stats. max_large_objects_bytes)
402+ , (" rts.max_compact_bytes" , Gauge . fromIntegral . Stats. max_compact_bytes)
403+ , (" rts.max_slop_bytes" , Gauge . fromIntegral . Stats. max_slop_bytes)
404+ , (" rts.max_mem_in_use_bytes" , Gauge . fromIntegral . Stats. max_mem_in_use_bytes)
405+ , (" rts.cumulative_live_bytes" , Counter . fromIntegral . Stats. cumulative_live_bytes)
406+ , (" rts.copied_bytes" , Counter . fromIntegral . Stats. copied_bytes)
407+ , (" rts.par_copied_bytes" , Gauge . fromIntegral . Stats. par_copied_bytes)
408+ , (" rts.cumulative_par_max_copied_bytes" , Gauge . fromIntegral . Stats. cumulative_par_max_copied_bytes)
409+ #if MIN_VERSION_base(4,11,0)
410+ , (" rts.cumulative_par_balanced_copied_bytes" , Gauge . fromIntegral . Stats. cumulative_par_balanced_copied_bytes)
411+ #endif
432412#if MIN_VERSION_base(4,12,0)
433- , (" rts.gc.init_cpu_ms " , Counter . nsToMs . Stats. init_cpu_ns)
434- , (" rts.gc.init_wall_ms " , Counter . nsToMs . Stats. init_elapsed_ns)
413+ , (" rts.init_cpu_ns " , Counter . Stats. init_cpu_ns)
414+ , (" rts.init_elapsed_ns " , Counter . Stats. init_elapsed_ns)
435415#endif
436- , (" rts.gc.mutator_cpu_ms" , Counter . nsToMs . Stats. mutator_cpu_ns)
437- , (" rts.gc.mutator_wall_ms" , Counter . nsToMs . Stats. mutator_elapsed_ns)
438- , (" rts.gc.gc_cpu_ms" , Counter . nsToMs . Stats. gc_cpu_ns)
439- , (" rts.gc.gc_wall_ms" , Counter . nsToMs . Stats. gc_elapsed_ns)
440- , (" rts.gc.cpu_ms" , Counter . nsToMs . Stats. cpu_ns)
441- , (" rts.gc.wall_ms" , Counter . nsToMs . Stats. elapsed_ns)
442- , (" rts.gc.max_bytes_used" , Gauge . fromIntegral . Stats. max_live_bytes)
443- , (" rts.gc.current_bytes_used" , Gauge . fromIntegral . Stats. gcdetails_live_bytes . Stats. gc)
444- , (" rts.gc.current_bytes_slop" , Gauge . fromIntegral . Stats. gcdetails_slop_bytes . Stats. gc)
445- , (" rts.gc.max_bytes_slop" , Gauge . fromIntegral . Stats. max_slop_bytes)
446- , (" rts.gc.peak_megabytes_allocated" , Gauge . fromIntegral . (`quot` (1024 * 1024 )) . Stats. max_mem_in_use_bytes)
447- , (" rts.gc.par_tot_bytes_copied" , Gauge . fromIntegral . Stats. par_copied_bytes)
448- , (" rts.gc.par_avg_bytes_copied" , Gauge . fromIntegral . Stats. par_copied_bytes)
449- , (" rts.gc.par_max_bytes_copied" , Gauge . fromIntegral . Stats. cumulative_par_max_copied_bytes)
416+ , (" rts.mutator_cpu_ns" , Counter . Stats. mutator_cpu_ns)
417+ , (" rts.mutator_elapsed_ns" , Counter . Stats. mutator_elapsed_ns)
418+ , (" rts.gc_cpu_ns" , Counter . Stats. gc_cpu_ns)
419+ , (" rts.gc_elapsed_ns" , Counter . Stats. gc_elapsed_ns)
420+ , (" rts.cpu_ns" , Counter . Stats. cpu_ns)
421+ , (" rts.elapsed_ns" , Counter . Stats. elapsed_ns)
422+ -- GCDetails
423+ , (" rts.gc.gen" , Gauge . fromIntegral . Stats. gcdetails_gen . Stats. gc)
424+ , (" rts.gc.threads" , Gauge . fromIntegral . Stats. gcdetails_threads . Stats. gc)
425+ , (" rts.gc.allocated_bytes" , Gauge . fromIntegral . Stats. gcdetails_allocated_bytes . Stats. gc)
426+ , (" rts.gc.live_bytes" , Gauge . fromIntegral . Stats. gcdetails_live_bytes . Stats. gc)
427+ , (" rts.gc.large_objects_bytes" , Gauge . fromIntegral . Stats. gcdetails_large_objects_bytes . Stats. gc)
428+ , (" rts.gc.compact_bytes" , Gauge . fromIntegral . Stats. gcdetails_compact_bytes . Stats. gc)
429+ , (" rts.gc.slop_bytes" , Gauge . fromIntegral . Stats. gcdetails_slop_bytes . Stats. gc)
430+ , (" rts.gc.mem_in_use_bytes" , Gauge . fromIntegral . Stats. gcdetails_mem_in_use_bytes . Stats. gc)
431+ , (" rts.gc.copied_bytes" , Gauge . fromIntegral . Stats. gcdetails_copied_bytes . Stats. gc)
432+ , (" rts.gc.par_max_copied_bytes" , Gauge . fromIntegral . Stats. gcdetails_par_max_copied_bytes . Stats. gc)
433+ , (" rts.gc.sync_elapsed_ns" , Gauge . fromIntegral . Stats. gcdetails_sync_elapsed_ns . Stats. gc)
434+ , (" rts.gc.cpu_ns" , Gauge . fromIntegral . Stats. gcdetails_cpu_ns . Stats. gc)
435+ , (" rts.gc.elapsed_ns" , Gauge . fromIntegral . Stats. gcdetails_elapsed_ns . Stats. gc)
450436 ])
451437 getRTSStats
452438#else
439+ -- Pre base-4.10 we have the names from before GHC commit 24e6594cc7890babe69b8ba122d171affabad2d1.
453440 (M. fromList
454441 [ (" rts.gc.bytes_allocated" , Counter . Stats. bytesAllocated)
455442 , (" rts.gc.num_gcs" , Counter . Stats. numGcs)
0 commit comments