File: test.ml

package info (click to toggle)
ocaml-mem-usage 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: ansic: 253; ml: 96; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(*
 * SPDX-FileCopyrightText: 2022 - 2024 Savonet team
 *
 * SPDX-License-Identifier: MIT
 *)

let () =
  let {
    Mem_usage.total_virtual_memory;
    total_physical_memory;
    total_used_virtual_memory;
    total_used_physical_memory;
    process_virtual_memory;
    process_physical_memory;
    process_private_memory;
    process_swapped_memory;
  } =
    Mem_usage.info ()
  in
  Printf.printf
    {|
Total virtual memory:    %s
Total physical memory:   %s
Used virtual memory:     %s
Used physical memory:    %s
Process virtual memory:  %s
Process physical memory: %s
Process private memory:  %s
Process swapped memory:  %s
|}
    (Mem_usage.prettify_bytes total_virtual_memory)
    (Mem_usage.prettify_bytes total_physical_memory)
    (Mem_usage.prettify_bytes total_used_virtual_memory)
    (Mem_usage.prettify_bytes total_used_physical_memory)
    (Mem_usage.prettify_bytes process_virtual_memory)
    (Mem_usage.prettify_bytes process_physical_memory)
    (Mem_usage.prettify_bytes process_private_memory)
    (Mem_usage.prettify_bytes process_swapped_memory)