src/Pure/ML/ml_profiling.ML
author wenzelm
Fri, 31 Aug 2018 22:25:58 +0200
changeset 68865 dd44e31ca2c6
parent 62945 c38c08889aa9
child 73834 364bac6691de
permissions -rw-r--r--
support multiple inheritance of ML environments, with canonical merge order as in Context.begin_theory;

(*  Title:      Pure/ML/ml_profiling.ML
    Author:     Makarius

ML profiling.
*)

signature ML_PROFILING =
sig
  val profile_time: ((int * string) list -> unit) -> ('a -> 'b) -> 'a -> 'b
  val profile_time_thread: ((int * string) list -> unit) -> ('a -> 'b) -> 'a -> 'b
  val profile_allocations: ((int * string) list -> unit) -> ('a -> 'b) -> 'a -> 'b
end;

structure ML_Profiling: ML_PROFILING =
struct

fun profile_time pr f x =
  PolyML.Profiling.profileStream pr PolyML.Profiling.ProfileTime f x;

fun profile_time_thread pr f x =
  PolyML.Profiling.profileStream pr PolyML.Profiling.ProfileTimeThisThread f x;

fun profile_allocations pr f x =
  PolyML.Profiling.profileStream pr PolyML.Profiling.ProfileAllocations f x;

end;