package ocaml-base-compiler

  1. Overview
  2. Docs

Compiler performance recording

type file = string
type source_provenance =
  1. | File of file
  2. | Pack of string
  3. | Startup
  4. | Toplevel
type compiler_pass =
  1. | All
  2. | Parsing of file
  3. | Parser of file
  4. | Dash_pp of file
  5. | Dash_ppx of file
  6. | Typing of file
  7. | Transl of file
  8. | Generate of file
  9. | Assemble of source_provenance
  10. | Clambda of source_provenance
  11. | Cmm of source_provenance
  12. | Compile_phrases of source_provenance
  13. | Selection of source_provenance
  14. | Comballoc of source_provenance
  15. | CSE of source_provenance
  16. | Liveness of source_provenance
  17. | Deadcode of source_provenance
  18. | Spill of source_provenance
  19. | Split of source_provenance
  20. | Regalloc of source_provenance
  21. | Linearize of source_provenance
  22. | Scheduling of source_provenance
  23. | Emit of source_provenance
  24. | Flambda_pass of string * source_provenance
val reset : unit -> unit

erase all recorded times

val get : compiler_pass -> float option

returns the runtime in seconds of a completed pass

val time_call : compiler_pass -> (unit -> 'a) -> 'a

time_call pass f calls f and records its runtime.

val time : compiler_pass -> ('a -> 'b) -> 'a -> 'b

time pass f arg records the runtime of f arg

val accumulate_time : compiler_pass -> ('a -> 'b) -> 'a -> 'b

Like time for passes that can run multiple times

val print : Format.formatter -> unit

Prints all recorded timings to the formatter.