summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2006-11-28 15:59:35 +0000
committerDamien Doligez <damien.doligez-inria.fr>2006-11-28 15:59:35 +0000
commiteaf64f01e574007d48e28aed1d95ae14e8c76c3e (patch)
treec4826a90df1b013b58052d6440fe016a4b334821
parentf38100ea36898f8194b8df348dda864b7f6c2a5f (diff)
ajout variable OCAMLPROF_DUMP pour profiler
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7762 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--stdlib/sys.ml2
-rw-r--r--tools/ocamlcp.ml2
-rw-r--r--tools/profiling.ml9
3 files changed, 8 insertions, 5 deletions
diff --git a/stdlib/sys.ml b/stdlib/sys.ml
index 8b4abca03..93ef3e764 100644
--- a/stdlib/sys.ml
+++ b/stdlib/sys.ml
@@ -78,4 +78,4 @@ let catch_break on =
(* OCaml version string, must be in the format described in sys.mli. *)
-let ocaml_version = "3.10+dev19 (2006-11-24)";;
+let ocaml_version = "3.10+dev20 (2006-11-28)";;
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index a9d778813..d22d2f1a6 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -96,7 +96,7 @@ let add_profarg s =
let optlist =
("-p", Arg.String add_profarg,
- "[afilmt] Profile constructs specified by argument:\n\
+ "[afilmt] Profile constructs specified by argument (default fm):\n\
\032 a Everything\n\
\032 f Function calls and method calls\n\
\032 i if ... then ... else\n\
diff --git a/tools/profiling.ml b/tools/profiling.ml
index a6e05ea56..3527ab3da 100644
--- a/tools/profiling.ml
+++ b/tools/profiling.ml
@@ -24,8 +24,11 @@ let incr a i = a.(i) <- a.(i) + 1;;
exception Bad_profile
let dump_counters () =
- begin try
- let ic = open_in_bin "ocamlprof.dump" in
+ let dumpfile =
+ try Sys.getenv "OCAMLPROF_DUMP" with Not_found -> "ocamlprof.dump"
+ in
+ begin try
+ let ic = open_in_bin dumpfile in
let prevl = (input_value ic : profiling_counters) in
close_in ic;
List.iter2
@@ -44,7 +47,7 @@ let dump_counters () =
with _ -> ()
end;
begin try
- let oc = open_out_bin "ocamlprof.dump" in
+ let oc = open_out_bin dumpfile in
output_value oc !counters;
close_out oc
with _ -> ()