From f481ede5e31e02fad95d3d0659afb905ed9e03c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Wed, 22 Feb 2012 17:53:34 +0100 Subject: [PATCH] Add function to query the memory usage of the BP structure. --- src/OCamlDriver.cpp | 5 +++++ src/bp.ml | 1 + src/bp.mli | 1 + 3 files changed, 7 insertions(+) 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 -- 2.17.1