package core_profiler

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

Source file probe_type.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
open! Core
open Core_profiler_disabled

type t =
  | Timer
  | Probe of Profiler_units.t
[@@deriving sexp, compare]

let to_string = function
  | Timer -> "Timer"
  | Probe u -> "Probe " ^ (Profiler_units.to_string u)

let to_char = function
  | Timer              -> 'M'
  | Probe Words        -> 'W'
  | Probe Seconds      -> 'S'
  | Probe Nanoseconds  -> 'N'
  | Probe Int        -> 'O'

let of_char = function
  | 'M' -> Timer
  | 'W' -> Probe Words
  | 'S' -> Probe Seconds
  | 'N' -> Probe Nanoseconds
  | 'O' -> Probe Int
  |  _  -> failwith "Invalid Spec character"

let is_probe = function
  | Timer -> false
  | Probe _ -> true

let units = function
  | Timer -> None
  | Probe u -> Some u