forked from facebook/pyre-check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profiling.mli
67 lines (53 loc) · 1.46 KB
/
profiling.mli
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
(* Copyright (c) 2019-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. *)
module GlobalState : sig
type t
val initialize
: ?profiling_output:string option ->
?memory_profiling_output:string option ->
unit ->
unit
val get : unit -> t
val restore : t -> unit
end
module Event : sig
type event_type =
| Duration of int
| Counter of string option
[@@deriving yojson]
type t = {
name: string;
worker_id: int;
pid: int;
event_type: event_type;
timestamp: int;
tags: (string * string) list;
}
[@@deriving yojson]
val create
: ?timestamp:int ->
?tags:(string * string) list ->
event_type:event_type ->
string ->
t
end
val log_performance_event : (unit -> Event.t) -> unit
val track_duration_event : ?tags:(string * string) list -> f:(unit -> 'a) -> string -> 'a
type 'a result_with_tags = {
result: 'a;
tags: unit -> (string * string) list;
}
val track_duration_event_with_dynamic_tags : f:(unit -> 'a result_with_tags) -> string -> 'a
val track_shared_memory_usage : ?name:string -> unit -> unit
val track_duration_and_shared_memory
: ?tags:(string * string) list ->
f:(unit -> 'a) ->
string ->
'a
val track_duration_and_shared_memory_with_dynamic_tags
: f:(unit -> 'a result_with_tags) ->
string ->
'a
(** Convenient functions to track both time and shared memory usage *)