Js_of_ocaml.PerformancePerformance 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 |> ignoreclass type performanceEntry = object ... endclass type 'detail performanceMark = object ... endclass type 'detail performanceMeasure = object ... endclass type 'detail performanceMarkOptions = object ... endclass type 'detail performanceMeasureOptions = object ... endclass type performance = object ... endval performance : performance Js.tWindow.performance, the global Performance object.
val mark :
?detail:'a ->
?startTime:Js.number_t ->
performance Js.t ->
Js.js_string Js.t ->
'a performanceMark Js.tWrapper 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.tSmart 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.