File: runtime.liq

package info (click to toggle)
liquidsoap 2.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,924 kB
  • sloc: ml: 73,577; javascript: 24,836; sh: 3,440; makefile: 764; xml: 114; ansic: 96; lisp: 62; python: 35; perl: 8; ruby: 8
file content (32 lines) | stat: -rw-r--r-- 1,374 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
# Returns information about the system and process' memory
# usage. Requires `mem_usage` for a full report.
# @category Liquidsoap
def runtime.memory() =
  x = {
    process_managed_memory = runtime.gc.quick_stat().heap_words * runtime.sys.word_size / 8
  }

%ifdef runtime.mem_usage
  info = runtime.mem_usage()
  x = x.{
    total_virtual_memory = info.total_virtual_memory,
    total_physical_memory = info.total_physical_memory,
    total_used_virtual_memory = info.total_used_virtual_memory,
    total_used_physical_memory = info.total_used_physical_memory,
    process_virtual_memory = info.process_virtual_memory,
    process_physical_memory = info.process_physical_memory
  }

  let x.pretty = {
    process_managed_memory = runtime.mem_usage.prettify_bytes(x.process_managed_memory),
    total_virtual_memory = runtime.mem_usage.prettify_bytes(info.total_virtual_memory),
    total_physical_memory = runtime.mem_usage.prettify_bytes(info.total_physical_memory),
    total_used_virtual_memory = runtime.mem_usage.prettify_bytes(info.total_used_virtual_memory),
    total_used_physical_memory = runtime.mem_usage.prettify_bytes(info.total_used_physical_memory),
    process_virtual_memory = runtime.mem_usage.prettify_bytes(info.process_virtual_memory),
    process_physical_memory = runtime.mem_usage.prettify_bytes(info.process_physical_memory)
  }
%endif

  x
end