summaryrefslogtreecommitdiff
path: root/ocaml/test/cache_solid.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/test/cache_solid.ml')
-rw-r--r--ocaml/test/cache_solid.ml39
1 files changed, 37 insertions, 2 deletions
diff --git a/ocaml/test/cache_solid.ml b/ocaml/test/cache_solid.ml
index f82e0b8..7ad7df0 100644
--- a/ocaml/test/cache_solid.ml
+++ b/ocaml/test/cache_solid.ml
@@ -20,9 +20,44 @@ let cache_solid env =
Printf.printf "Step 2: Cuing (this will take several minutes)...\n";
let start = Unix.gettimeofday () in
- let pill = Serial.cue pill_bytes in
+ let last_tick = ref start in
+ let last_nouns = ref 0 in
+ let last_depth = ref 0 in
+ let last_peak = ref 0 in
+ let bytes_seen = ref 0 in
+
+ let total_bytes = Bytes.length pill_bytes in
+
+ let progress ~nouns ~bits ~depth ~max_depth =
+ last_nouns := nouns;
+ last_depth := depth;
+ last_peak := max_depth;
+ bytes_seen := bits / 8;
+
+ let now = Unix.gettimeofday () in
+ if now -. !last_tick >= 1.0 then begin
+ let mb = float_of_int !bytes_seen /. (1024. *. 1024.) in
+ let pct = (float_of_int !bytes_seen /. float_of_int total_bytes) *. 100. in
+ Printf.printf " %.1fs | %.2f MiB (%.1f%%) | nouns=%d depth=%d/%d\n%!"
+ (now -. start) mb pct !last_nouns !last_depth !last_peak;
+ last_tick := now
+ end
+ in
+
+ let pill =
+ Serial.cue
+ ~progress
+ ~progress_interval:50_000
+ pill_bytes
+ in
+
let elapsed = Unix.gettimeofday () -. start in
- Printf.printf " ✓ Cued in %.1fs\n\n" elapsed;
+ Printf.printf
+ " ✓ Cued in %.1fs (%.2f MiB, nouns=%d, max depth=%d)\n\n"
+ elapsed
+ (float_of_int total_bytes /. (1024. *. 1024.))
+ !last_nouns
+ !last_peak;
Printf.printf "Step 3: Marshalling noun to solid.noun...\n";
let out_channel = open_out_bin "solid.noun" in