src/Pure/RAW/ml_profiling_polyml.ML
author wenzelm
Wed, 23 Dec 2015 23:09:13 +0100
changeset 61925 ab52f183f020
parent 61885 src/Pure/ML-Systems/ml_profiling_polyml.ML@acdfc76a6c33
permissions -rw-r--r--
clarified directory structure;

(*  Title:      Pure/RAW/ml_profiling_polyml.ML
    Author:     Makarius

Profiling for Poly/ML.
*)

structure ML_Profiling =
struct

local

fun profile n f x =
  let
    val _ = RunCall.run_call1 RuntimeCalls.POLY_SYS_profiler n;
    val res = Exn.capture f x;
    val _ = RunCall.run_call1 RuntimeCalls.POLY_SYS_profiler 0;
  in Exn.release res end;

in

fun profile_time (_: (int * string) list -> unit) f x = profile 1 f x;
fun profile_time_thread (_: (int * string) list -> unit) f x = profile 6 f x;
fun profile_allocations (_: (int * string) list -> unit) f x = profile 2 f x;

end;

end;