From: Kim Nguyễn Date: Wed, 22 Feb 2012 16:53:34 +0000 (+0100) Subject: Add function to query the memory usage of the BP structure. X-Git-Url: http://git.nguyen.vg/gitweb/?a=commitdiff_plain;h=f481ede5e31e02fad95d3d0659afb905ed9e03c9;hp=071e25c710e9a48116f66ddf51bfdca25e20502b;p=SXSI%2Fxpathcomp.git Add function to query the memory usage of the BP structure. --- diff --git a/src/OCamlDriver.cpp b/src/OCamlDriver.cpp index ab145ec..7cf70c5 100644 --- a/src/OCamlDriver.cpp +++ b/src/OCamlDriver.cpp @@ -1155,3 +1155,8 @@ extern "C" value caml_bp_save(value b, value file) CAMLreturn(Val_unit); } +extern "C" value caml_bp_alloc_stats(value unit) +{ + CAMLparam1(unit); + CAMLreturn (Val_long(bp_get_alloc_stats())); +} diff --git a/src/bp.ml b/src/bp.ml index e230931..7dc4b49 100644 --- a/src/bp.ml +++ b/src/bp.ml @@ -30,6 +30,7 @@ let bitmap_push_back b i = type t external bp_construct : cbitmap -> int -> t = "caml_bp_construct" +external alloc_stats : unit -> int = "caml_bp_alloc_stats" external save : t -> Unix.file_descr -> unit = "caml_bp_save" external load : Unix.file_descr -> t = "caml_bp_load" external first_child : t -> int -> int = "caml_bp_first_child" "noalloc" diff --git a/src/bp.mli b/src/bp.mli index 7053493..55e5723 100644 --- a/src/bp.mli +++ b/src/bp.mli @@ -13,3 +13,4 @@ external first_child : t -> int -> int = "caml_bp_first_child" "noalloc" external next_sibling : t -> int -> int = "caml_bp_next_sibling" "noalloc" external preorder_rank : t -> int -> int = "caml_bp_preorder_rank" "noalloc" +val alloc_stats : unit -> int