From df9e020804a937d92f028e299415b2a437753db2 Mon Sep 17 00:00:00 2001 From: Thomas Gazagnaire Date: Wed, 29 Apr 2015 15:44:05 +0100 Subject: [PATCH] Tweak the stats reporting a little bit --- src/stats.ml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/stats.ml b/src/stats.ml index 42575c388..c61dae766 100644 --- a/src/stats.ml +++ b/src/stats.ml @@ -1,20 +1,23 @@ let (>>=) = Lwt.bind let delay = 60. *. 2. -let history = 10_000 +let history = 100 let html_of_stat t = let open Gc in let k f = - let str = Printf.sprintf "%.0fk" (f /. 1000.) in + let str = Printf.sprintf "%dk" (f / 1_000) in + Cow.Html.of_string str + in + let m f = + let str = Printf.sprintf "%.0fm" (f /. 1_000_000.) in Cow.Html.of_string str in <:html< - $k t.minor_words$ - $k t.major_words$ - $int:t.minor_collections$ - $int:t.major_collections$ + $m (Gc.allocated_bytes ())$ + $k t.heap_words$ + $k t.live_words$ >> @@ -22,10 +25,9 @@ let html_of_stats ts = <:html< - - - - + + + $list:List.map html_of_stat ts$
Minor WordsMajor WordsMinor CollectionsMajor CollectionsAllocated BytesHeap WordsLive Words
@@ -35,7 +37,7 @@ let stats = Queue.create () let start ~sleep = let gather () = - let stat = Gc.quick_stat () in + let stat = Gc.stat () in if Queue.length stats >= history then ignore (Queue.pop stats); Queue.push stat stats in