X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fprofile.ml;fp=src%2Fprofile.ml;h=c43dda67c9ae5de609d6d6e0deea2c7405e83c96;hb=4b52da1a20a4fe031930bb96d2ca46bec06dc529;hp=0000000000000000000000000000000000000000;hpb=a223af3254fb51c279cfbccdc18c59484fdca74e;p=SXSI%2Fxpathcomp.git diff --git a/src/profile.ml b/src/profile.ml new file mode 100644 index 0000000..c43dda6 --- /dev/null +++ b/src/profile.ml @@ -0,0 +1,11 @@ +let table = Hashtbl.create 103 + +let summary fmt = + Hashtbl.iter (fun (m, f) d -> + let c, tl = !d in + let tspent = + List.fold_left (fun acc e -> e +. acc) 0. tl + in + Format.fprintf fmt "%s: %s = called %i times, total: %fms, average: %fms\n" + m f c tspent (tspent /. (float_of_int c))) table; + Format.fprintf fmt "%!"