Source file tally_mkernel.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

let stat devices () =
  List.map (fun (handle, name, typ) ->
      let s = Mkernel.Stats.from handle in
      [ "name", name ; "type", typ ],
      Mkernel.Stats.[
        "rx_ops", rx_ops s ;
        "rx_bytes", rx_bytes s ;
        "tx_ops", tx_ops s ;
        "tx_bytes", tx_bytes s ;
      ])
    devices

let malloc_stat () =
  let Mkernel.Stats.{ heap_words ; live_words ; stack_words ; free_words } = Mkernel.Stats.malloc () in
  [ [], [ "heap_words", heap_words ; "live_words", live_words ; "stack_words", stack_words ; "free_words", free_words ] ]

let init () =
  let _device_tally = Tally.v "device" (stat (Mkernel.Stats.devices ())) in
  let _malloc_tally = Tally.v "malloc" malloc_stat in
  ()