summaryrefslogtreecommitdiff
path: root/lib/ocaml_rts
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-10-26 14:58:49 +0100
committerAlasdair Armstrong2017-10-26 14:58:49 +0100
commit68d109416999f31bf0674516e69d56ea9995be0d (patch)
tree31f922c8a9500272c8b2b1eec4cc1c92d41023ee /lib/ocaml_rts
parent5fc7d18f2ab65100b2a0894daae874145b5d6813 (diff)
Updated ocaml backend so tracing instrumentation is optional.
Cleaned up the option list in sail.ml
Diffstat (limited to 'lib/ocaml_rts')
-rw-r--r--lib/ocaml_rts/sail_lib.ml11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ocaml_rts/sail_lib.ml b/lib/ocaml_rts/sail_lib.ml
index 5f83b9c2..a0ba31eb 100644
--- a/lib/ocaml_rts/sail_lib.ml
+++ b/lib/ocaml_rts/sail_lib.ml
@@ -2,6 +2,8 @@ open Big_int
type 'a return = { return : 'b . 'a -> 'b }
+let opt_trace = ref false
+
let trace_depth = ref 0
let random = ref false
@@ -15,8 +17,13 @@ let sail_call (type t) (f : _ -> t) =
with M.Return x -> x
let trace str =
- if !trace_depth < 0 then trace_depth := 0 else ();
- prerr_endline (String.make (!trace_depth * 2) ' ' ^ str)
+ if !opt_trace
+ then
+ begin
+ if !trace_depth < 0 then trace_depth := 0 else ();
+ prerr_endline (String.make (!trace_depth * 2) ' ' ^ str)
+ end
+ else ()
let trace_write name str =
trace ("Write: " ^ name ^ " " ^ str)