Skip to content

Commit 218d177

Browse files
committed
Driver: fix total number of indexes to compute in progress bars
1 parent 59843e6 commit 218d177

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/driver/compile.ml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,30 @@ let mk_byhash (pkgs : Odoc_unit.intf Odoc_unit.unit list) =
1010
Util.StringMap.empty pkgs
1111

1212
let init_stats (units : Odoc_unit.t list) =
13-
let total, total_impl, non_hidden, mlds =
13+
let total, total_impl, non_hidden, mlds, indexes =
1414
List.fold_left
15-
(fun (total, total_impl, non_hidden, mlds) (unit : Odoc_unit.t) ->
15+
(fun (total, total_impl, non_hidden, mlds, indexes) (unit : Odoc_unit.t) ->
1616
let total = match unit.kind with `Intf _ -> total + 1 | _ -> total in
1717
let total_impl =
1818
match unit.kind with `Impl _ -> total_impl + 1 | _ -> total_impl
1919
in
20+
let indexes = Fpath.Set.add unit.index.output_file indexes in
2021
let non_hidden =
2122
match unit.kind with
2223
| `Intf { hidden = false; _ } -> non_hidden + 1
2324
| _ -> non_hidden
2425
in
2526
let mlds = match unit.kind with `Mld -> mlds + 1 | _ -> mlds in
26-
(total, total_impl, non_hidden, mlds))
27-
(0, 0, 0, 0) units
27+
(total, total_impl, non_hidden, mlds, indexes))
28+
(0, 0, 0, 0, Fpath.Set.empty)
29+
units
2830
in
2931

3032
Atomic.set Stats.stats.total_units total;
3133
Atomic.set Stats.stats.total_impls total_impl;
3234
Atomic.set Stats.stats.non_hidden_units non_hidden;
33-
Atomic.set Stats.stats.total_mlds mlds
35+
Atomic.set Stats.stats.total_mlds mlds;
36+
Atomic.set Stats.stats.total_indexes (Fpath.Set.cardinal indexes)
3437

3538
open Eio.Std
3639

src/driver/odoc_driver.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ let render_stats env nprocs =
451451
let total = Atomic.get Stats.stats.total_units in
452452
let total_impls = Atomic.get Stats.stats.total_impls in
453453
let total_mlds = Atomic.get Stats.stats.total_mlds in
454+
let total_indexes = Atomic.get Stats.stats.total_indexes in
454455
let bar message total =
455456
let open Progress.Line in
456457
list [ lpad 16 (const message); bar total; count_to total ]
@@ -476,7 +477,7 @@ let render_stats env nprocs =
476477
++ dline "Linking" non_hidden
477478
++ dline "Linking impls" total_impls
478479
++ dline "Linking mlds" total_mlds
479-
++ dline "Indexes" 10000 (* TODO *)
480+
++ dline "Indexes" total_indexes
480481
++ dline "HTML" (total_impls + non_hidden + total_mlds)
481482
++ line (procs nprocs)
482483
++ descriptions)

src/driver/stats.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type stats = {
66
mutable total_units : int Atomic.t;
77
mutable total_impls : int Atomic.t;
88
mutable total_mlds : int Atomic.t;
9+
mutable total_indexes : int Atomic.t;
910
mutable non_hidden_units : int Atomic.t;
1011
mutable compiled_units : int Atomic.t;
1112
mutable compiled_impls : int Atomic.t;
@@ -24,6 +25,7 @@ let stats =
2425
total_units = Atomic.make 0;
2526
total_impls = Atomic.make 0;
2627
total_mlds = Atomic.make 0;
28+
total_indexes = Atomic.make 0;
2729
non_hidden_units = Atomic.make 0;
2830
compiled_units = Atomic.make 0;
2931
compiled_impls = Atomic.make 0;

0 commit comments

Comments
 (0)