9 |
|
|
10 |
let _ = |
let _ = |
11 |
add_memstat "Gc" (fun level buf -> |
add_memstat "Gc" (fun level buf -> |
12 |
let stat = Gc.stat () in |
let stat = if level > 0 then Gc.stat () else Gc.quick_stat () in |
13 |
let ab = (stat.Gc.minor_words +. stat.Gc.major_words -. stat.Gc.promoted_words) |
let ab = (stat.Gc.minor_words +. stat.Gc.major_words -. stat.Gc.promoted_words) |
14 |
*. float_of_int (Sys.word_size / 8) in |
*. float_of_int (Sys.word_size / 8) in |
15 |
Printf.bprintf buf "minor_words: %.0f\n" stat.Gc.minor_words; |
Printf.bprintf buf "minor_words: %.0f\n" stat.Gc.minor_words; |
19 |
Printf.bprintf buf "major_collections: %d\n" stat.Gc.major_collections; |
Printf.bprintf buf "major_collections: %d\n" stat.Gc.major_collections; |
20 |
Printf.bprintf buf "heap_words: %d\n" stat.Gc.heap_words; |
Printf.bprintf buf "heap_words: %d\n" stat.Gc.heap_words; |
21 |
Printf.bprintf buf "heap_chunks: %d\n" stat.Gc.heap_chunks; |
Printf.bprintf buf "heap_chunks: %d\n" stat.Gc.heap_chunks; |
22 |
Printf.bprintf buf "live_words: %d\n" stat.Gc.live_words; |
if stat.Gc.live_words > 0 then |
23 |
Printf.bprintf buf "live_blocks: %d\n" stat.Gc.live_blocks; |
Printf.bprintf buf "live_words: %d\n" stat.Gc.live_words; |
24 |
Printf.bprintf buf "free_words: %d\n" stat.Gc.free_words; |
if stat.Gc.live_blocks > 0 then |
25 |
Printf.bprintf buf "free_blocks: %d\n" stat.Gc.free_blocks; |
Printf.bprintf buf "live_blocks: %d\n" stat.Gc.live_blocks; |
26 |
Printf.bprintf buf "largest_free: %d\n" stat.Gc.largest_free; |
if stat.Gc.free_words > 0 then |
27 |
Printf.bprintf buf "fragments: %d\n" stat.Gc.fragments; |
Printf.bprintf buf "free_words: %d\n" stat.Gc.free_words; |
28 |
|
if stat.Gc.free_blocks > 0 then |
29 |
|
Printf.bprintf buf "free_blocks: %d\n" stat.Gc.free_blocks; |
30 |
|
if stat.Gc.largest_free > 0 then |
31 |
|
Printf.bprintf buf "largest_free: %d\n" stat.Gc.largest_free; |
32 |
|
if stat.Gc.fragments > 0 then |
33 |
|
Printf.bprintf buf "fragments: %d\n" stat.Gc.fragments; |
34 |
Printf.bprintf buf "compactions: %d\n" stat.Gc.compactions; |
Printf.bprintf buf "compactions: %d\n" stat.Gc.compactions; |
35 |
Printf.bprintf buf "top_heap_words: %d\n" stat.Gc.top_heap_words; |
Printf.bprintf buf "top_heap_words: %d\n" stat.Gc.top_heap_words; |
36 |
Printf.bprintf buf "allocated_bytes: %.0f\n" ab; |
Printf.bprintf buf "allocated_bytes: %.0f\n" ab; |