compute uptime from now - started
This commit is contained in:
parent
ff59f05660
commit
da5ed22a14
|
@ -101,6 +101,11 @@ module P = struct
|
||||||
Printf.sprintf "resource_usage,vm=%s %s" vm (String.concat ~sep:"," fields)
|
Printf.sprintf "resource_usage,vm=%s %s" vm (String.concat ~sep:"," fields)
|
||||||
|
|
||||||
let encode_kinfo_mem vm mem =
|
let encode_kinfo_mem vm mem =
|
||||||
|
let now = Unix.gettimeofday () in
|
||||||
|
let started =
|
||||||
|
Int64.to_float (fst mem.start) +. (float_of_int (snd mem.start) /. 1_000_000.)
|
||||||
|
in
|
||||||
|
let uptime = now -. started in
|
||||||
let fields =
|
let fields =
|
||||||
[ "vsize", i64 mem.vsize ;
|
[ "vsize", i64 mem.vsize ;
|
||||||
"rss", i64 mem.rss ;
|
"rss", i64 mem.rss ;
|
||||||
|
@ -109,7 +114,7 @@ module P = struct
|
||||||
"ssize", i64 mem.ssize ;
|
"ssize", i64 mem.ssize ;
|
||||||
"cow_fauls", string_of_int mem.cow ;
|
"cow_fauls", string_of_int mem.cow ;
|
||||||
"runtime", i64 mem.runtime ;
|
"runtime", i64 mem.runtime ;
|
||||||
"start", tv mem.start ;
|
"uptime", Printf.sprintf "%f" uptime ;
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
let fields = List.map (fun (k, v) -> k ^ "=" ^ v) fields in
|
let fields = List.map (fun (k, v) -> k ^ "=" ^ v) fields in
|
||||||
|
|
Loading…
Reference in a new issue