package incr_dom_partial_render

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file instrumentation.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
open! Core
open! Incr_dom
open! Js_of_ocaml

let is_profiling = ref false

let () =
  Js.Unsafe.global##.startProfilingPrt
  := Js.wrap_callback (fun () -> is_profiling := true)
;;

let () =
  Js.Unsafe.global##.stopProfilingPrt
  := Js.wrap_callback (fun () -> is_profiling := false)
;;

let instrument name =
  { Incr.Map.Instrumentation.f =
      (fun f -> if !is_profiling then Javascript_profiling.record name ~f else f ())
  }
;;