(** PROFILING *)
-(* we should use a key in te registry, but we can't see the registry.. *)
-let profiling_enabled = true
+let profiling_enabled = ComponentsConf.profiling
let profiling_printings = ref (fun () -> true)
let set_profiling_printings f = profiling_printings := f
type profiler = { profile : 'a 'b. ('a -> 'b) -> 'a -> 'b }
let profile ?(enable = true) =
- if profiling_enabled && enable then
+ if profiling_enabled && enable then
function s ->
let total = ref 0.0 in
let profile f x =
let rec aux where = function
| [] -> ()
| piece::tl ->
- let path = where ^ "/" ^ piece in
+ let path =
+ if where = "" then piece else where ^ "/" ^ piece in
(try
Unix.mkdir path 0o755
with
("Unix.mkdir " ^ path ^ " 0o755 :" ^ (Unix.error_message e))));
aux path tl
in
- aux "" components
+ let where = if path.[0] = '/' then "/" else "" in
+ aux where components
(** {2 Filesystem} *)