blob: 5c49db90af2fba9435ae21221a7540b8be52b1f7 (
plain)
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
|
(* TEST
include runtime_events;
flags = "-runtime-variant=i";
instrumented-runtime;
native;
*)
open Runtime_events
let list_ref = ref []
let total_sizes = ref 0
let total_minors = ref 0
let lost_event_words = ref 0
let alloc domain_id ts sizes =
let size_accum = Array.fold_left (fun x y -> x + y) 0 sizes in
total_sizes := !total_sizes + size_accum
let runtime_end domain_id ts phase =
match phase with
| EV_MINOR ->
total_minors := !total_minors + 1
| _ -> ()
(* lost words of events *)
let lost_events domain_id words =
lost_event_words := !lost_event_words + words
let () =
Gc.full_major ();
start ();
let cursor = create_cursor None in
for a = 0 to 1_000_000 do
list_ref := (Sys.opaque_identity(ref 42)) :: !list_ref
done;
Gc.full_major ();
let callbacks = Callbacks.create ~runtime_end ~alloc ~lost_events () in
ignore(read_poll cursor callbacks None);
Printf.printf "lost_event_words: %d, total_sizes: %d, total_minors: %d\n"
!lost_event_words !total_sizes !total_minors
|