package memtrace_viewer

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

Source file data_intf.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
open! Core

module type Data = sig
  module Call_site : sig
    type t [@@deriving sexp, bin_io]

    val defname : t -> string
    val filename : t -> string
    val position : t -> string

    val create
      :  filename:string
      -> line:int
      -> start_char:int
      -> end_char:int
      -> defname:string
      -> t

    include Comparable.S with type t := t
    include Hashable.S with type t := t
  end

  module Allocation_site : sig
    type t [@@deriving sexp, bin_io]

    val of_call_site : Call_site.t -> t
    val defname : t -> string
    val filename : t -> string
    val position : t -> string
    val short_name : t -> string
    val full_name : t -> string

    include Comparable.S with type t := t
    include Hashable.S with type t := t

    module Debug : sig
      type nonrec t = t [@@deriving sexp_of]
    end
  end

  module Function : sig
    type t [@@deriving sexp, bin_io]

    val defname : t -> string
    val full_name : t -> call_sites:Call_site.t list option -> string
    val create : defname:string -> t

    include Comparable.S with type t := t
    include Hashable.S with type t := t

    module Debug : sig
      type nonrec t = t [@@deriving sexp_of]
    end
  end

  module Location : sig
    type t = private
      | Function of Function.t
      | Allocation_site of Allocation_site.t
      | Allocator
      | Toplevel
      | Dummy
    [@@deriving sexp, bin_io]

    include Comparable.S with type t := t
    include Hashable.S with type t := t

    val defname : t -> string
    val full_name : t -> call_sites:Call_site.t list option -> string
    val create_function : Function.t -> t
    val create_allocation_site : Call_site.t -> t
    val allocator : t
    val toplevel : t
    val dummy : t
    val is_allocator : t -> bool
    val is_toplevel : t -> bool
    val is_dummy : t -> bool
    val is_special : t -> bool

    module Debug : sig
      type nonrec t = t [@@deriving sexp_of]
    end
  end

  module Call_sites : sig
    type t [@@deriving sexp]

    val create : (Function.t * Call_site.t list) list -> t
    val for_function : t -> Function.t -> Call_site.t list
    val for_location : t -> Location.t -> Call_site.t list
  end

  module Graph : sig
    (* (time, major heap size) pairs *)
    type t [@@deriving sexp, bin_io]

    val create : (Time_ns.Span.t * Byte_units.t) list -> t
    val points : t -> (Time_ns.Span.t * Byte_units.t) list
    val max_x : t -> Time_ns.Span.t
    val max_y : t -> Byte_units.t
  end

  module Entry : sig
    type t [@@deriving sexp, bin_io]

    val allocations : t -> Byte_units.t
    val direct_allocations : t -> Byte_units.t
    val is_heavy : t -> bool
    val allocations_string : t -> string
    val percentage_string : t -> string

    val create
      :  total_allocations_in_trie:Byte_units.t
      -> allocations:Byte_units.t
      -> direct_allocations:Byte_units.t
      -> is_heavy:bool
      -> t

    module Debug : sig
      type nonrec t = t [@@deriving sexp_of]
    end
  end

  module Metadata : Fragment_trie.Metadata

  module Backtrace : sig
    include Fragment_trie.Backtrace with module Location := Location

    val is_trivial : t -> bool
  end

  module Fragment : sig
    include
      Fragment_trie.Fragment
      with module Location := Location
       and module Entry := Entry
       and module Backtrace := Backtrace

    val is_trivial : t -> bool
  end

  module type Suffix_tree =
    Fragment_trie.Suffix_tree with type location := Location.t and type entry := Entry.t

  module Fragment_trie : sig
    include
      Fragment_trie.Trie
      with module Location := Location
       and module Entry := Entry
       and module Metadata := Metadata
       and module Backtrace := Backtrace
       and module Fragment := Fragment

    val of_suffix_tree
      :  (module Suffix_tree with type t = 'tree)
      -> 'tree
      -> total_allocations:Byte_units.t
      -> t

    val allocator_fragment : t -> Fragment.t
    val toplevel_fragment : t -> Fragment.t
    val total_allocations : t -> Byte_units.t
  end

  module Info : sig
    type t =
      { sample_rate : float
      ; word_size : Byte_units.t
      ; executable_name : string
      ; host_name : string
      ; ocaml_runtime_params : string
      ; pid : Int64.t
      ; start_time : Time_ns.t
      ; context : string option
      }
    [@@deriving sexp, bin_io]
  end

  type t =
    { graph : Graph.t
    ; filtered_graph : Graph.t option (* could also merge the two graphs *)
    ; trie : Fragment_trie.t
    ; total_allocations_unfiltered : Byte_units.t
    ; peak_allocations : Byte_units.t
    ; peak_allocations_time : Time_ns.Span.t
    ; call_sites : Call_sites.t
    ; hot_paths : Fragment.t list
    ; hot_locations : Fragment.t list
    ; info : Info.t option
    }
  [@@deriving sexp]

  val empty : t

  module Serialized : sig
    type unserialized := t
    type t [@@deriving sexp, bin_io]

    val serialize : unserialized -> t
    val unserialize : t -> unserialized
  end
end
OCaml

Innovation. Community. Security.