Permalink
Browse files

log maxrss in reporting

  • Loading branch information...
1 parent 9c12cd6 commit 1cce3e5d17672ebca380abda4eb231c1df439e7e Romain Slootmaekers committed Jan 18, 2012
Showing with 16 additions and 4 deletions.
  1. +2 −4 src/node/node_main.ml
  2. +12 −0 src/tools/arakoon_limits.c
  3. +2 −0 src/tools/limits.ml
View
6 src/node/node_main.ml
@@ -243,16 +243,14 @@ module X = struct
let stats = backend # get_statistics () in
Lwt_log.info_f "stats: %s" (Statistics.Statistics.string_of stats)
>>= fun () ->
- (* let sqs = Lwt_unix.sleep_queue_size () in *)
- (* let ns = Lwt_unix.get_new_sleeps () in *)
- (* let wcl = Lwt_unix.wait_children_length () in *)
+ let maxrss = Limits.get_maxrss() in
let stat = Gc.stat () in
let factor = float (Sys.word_size / 8) in
let allocated = (stat.minor_words +.
stat.major_words -. stat.promoted_words) *.
(factor /. 1024.0)
in
- Lwt_log.info_f "nallocated=%f" allocated
+ Lwt_log.info_f "nallocated=%f KB; maxrss=%i KB" allocated maxrss
>>= fun () ->
backend # clear_most_statistics();
_inner ()
View
12 src/tools/arakoon_limits.c
@@ -50,3 +50,15 @@ CAMLprim value arakoon_get_rlimit(value v_resource, value soft){
}
CAMLreturn(Val_int(res2));
}
+
+CAMLprim value arakoon_get_maxrss(value unit){
+ CAMLparam1 (unit);
+ int who = RUSAGE_SELF;
+ struct rusage usage;
+ int res = getrusage(who, &usage);
+ if (res != 0){
+ caml_failwith ("get_rusage");
+ }
+ int res2 = usage.ru_maxrss;
+ CAMLreturn(Val_int(res2));
+}
View
2 src/tools/limits.ml
@@ -43,3 +43,5 @@ type soft_or_hard =
| Hard
external get_rlimit: resource -> soft_or_hard -> int = "arakoon_get_rlimit"
+
+external get_maxrss: unit -> int = "arakoon_get_maxrss"

0 comments on commit 1cce3e5

Please sign in to comment.