Module Js_of_ocaml.Performance

Performance API

A code example:

  let perf = Performance.performance in
  perf##mark (Js.string "start");
  do_something ();
  perf##mark (Js.string "end");
  let _ = perf##measure (Js.string "elapsed") (Js.string "start") (Js.string "end") in
  let entries = perf##getEntriesByType (Js.string "measure") in
  Js.array_get entries 0 |> ignore
class type performanceEntry = object ... end
class type 'detail performanceMark = object ... end
class type 'detail performanceMeasure = object ... end
class type 'detail performanceMarkOptions = object ... end
class type 'detail performanceMeasureOptions = object ... end
class type performance = object ... end
val performance : performance Js.t

Window.performance, the global Performance object.

val is_supported : unit -> bool

Whether the global performance object is defined.

val mark : ?detail:'a -> ?startTime:Js.number_t -> performance Js.t -> Js.js_string Js.t -> 'a performanceMark Js.t

Wrapper for Performance.mark(name, options?) taking labeled arguments.

val makeMeasureOptions : ?detail:'a -> ?start:Js.js_string Js.t -> ?start_time:Js.number_t -> ?_end:Js.js_string Js.t -> ?end_time:Js.number_t -> ?duration:Js.number_t -> unit -> 'a performanceMeasureOptions Js.t

Smart constructor for performanceMeasureOptions.

Raises Invalid_argument if both ?start and ?start_time, or both ?_end and ?end_time, are provided — they map to the same JavaScript field.