@@ -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
@@ -424,32 +421,50 @@ registerGcMetrics store =
424421 registerGroup
425422#if MIN_VERSION_base(4,10,0)
426423 (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)
424+ -- We order them the same way as they are in GHC.Stats for easy comparison.
425+ [ (" rts.gcs" , Counter . fromIntegral . Stats. gcs)
426+ , (" rts.major_gcs" , Counter . fromIntegral . Stats. major_gcs)
427+ , (" rts.allocated_bytes" , Counter . fromIntegral . Stats. allocated_bytes)
428+ , (" rts.max_live_bytes" , Gauge . fromIntegral . Stats. max_live_bytes)
429+ , (" rts.max_large_objects_bytes" , Gauge . fromIntegral . Stats. max_large_objects_bytes)
430+ , (" rts.max_compact_bytes" , Gauge . fromIntegral . Stats. max_compact_bytes)
431+ , (" rts.max_slop_bytes" , Gauge . fromIntegral . Stats. max_slop_bytes)
432+ , (" rts.max_mem_in_use_bytes" , Gauge . fromIntegral . Stats. max_mem_in_use_bytes)
433+ , (" rts.cumulative_live_bytes" , Counter . fromIntegral . Stats. cumulative_live_bytes)
434+ , (" rts.copied_bytes" , Counter . fromIntegral . Stats. copied_bytes)
435+ , (" rts.par_copied_bytes" , Gauge . fromIntegral . Stats. par_copied_bytes)
436+ , (" rts.cumulative_par_max_copied_bytes" , Gauge . fromIntegral . Stats. cumulative_par_max_copied_bytes)
437+ #if MIN_VERSION_base(4,11,0)
438+ , (" rts.cumulative_par_balanced_copied_bytes" , Gauge . fromIntegral . Stats. cumulative_par_balanced_copied_bytes)
439+ #endif
432440#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)
441+ , (" rts.init_cpu_ns " , Counter . Stats. init_cpu_ns)
442+ , (" rts.init_elapsed_ns " , Counter . Stats. init_elapsed_ns)
435443#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)
444+ , (" rts.mutator_cpu_ns" , Counter . Stats. mutator_cpu_ns)
445+ , (" rts.mutator_elapsed_ns" , Counter . Stats. mutator_elapsed_ns)
446+ , (" rts.gc_cpu_ns" , Counter . Stats. gc_cpu_ns)
447+ , (" rts.gc_elapsed_ns" , Counter . Stats. gc_elapsed_ns)
448+ , (" rts.cpu_ns" , Counter . Stats. cpu_ns)
449+ , (" rts.elapsed_ns" , Counter . Stats. elapsed_ns)
450+ -- GCDetails
451+ , (" rts.gc.gen" , Gauge . fromIntegral . Stats. gcdetails_gen . Stats. gc)
452+ , (" rts.gc.threads" , Gauge . fromIntegral . Stats. gcdetails_threads . Stats. gc)
453+ , (" rts.gc.allocated_bytes" , Gauge . fromIntegral . Stats. gcdetails_allocated_bytes . Stats. gc)
454+ , (" rts.gc.live_bytes" , Gauge . fromIntegral . Stats. gcdetails_live_bytes . Stats. gc)
455+ , (" rts.gc.large_objects_bytes" , Gauge . fromIntegral . Stats. gcdetails_large_objects_bytes . Stats. gc)
456+ , (" rts.gc.compact_bytes" , Gauge . fromIntegral . Stats. gcdetails_compact_bytes . Stats. gc)
457+ , (" rts.gc.slop_bytes" , Gauge . fromIntegral . Stats. gcdetails_slop_bytes . Stats. gc)
458+ , (" rts.gc.mem_in_use_bytes" , Gauge . fromIntegral . Stats. gcdetails_mem_in_use_bytes . Stats. gc)
459+ , (" rts.gc.copied_bytes" , Gauge . fromIntegral . Stats. gcdetails_copied_bytes . Stats. gc)
460+ , (" rts.gc.par_max_copied_bytes" , Gauge . fromIntegral . Stats. gcdetails_par_max_copied_bytes . Stats. gc)
461+ , (" rts.gc.sync_elapsed_ns" , Gauge . fromIntegral . Stats. gcdetails_sync_elapsed_ns . Stats. gc)
462+ , (" rts.gc.cpu_ns" , Gauge . fromIntegral . Stats. gcdetails_cpu_ns . Stats. gc)
463+ , (" rts.gc.elapsed_ns" , Gauge . fromIntegral . Stats. gcdetails_elapsed_ns . Stats. gc)
450464 ])
451465 getRTSStats
452466#else
467+ -- Pre base-4.10 we have the names from before GHC commit 24e6594cc7890babe69b8ba122d171affabad2d1.
453468 (M. fromList
454469 [ (" rts.gc.bytes_allocated" , Counter . Stats. bytesAllocated)
455470 , (" rts.gc.num_gcs" , Counter . Stats. numGcs)
0 commit comments