| 
2 | 2 | open Core  | 
3 | 3 | open Async  | 
4 | 4 | open Mina_base  | 
5 |  | -module Ledger = Mina_ledger.Ledger  | 
6 |  | -module Sync_ledger = Mina_ledger.Sync_ledger  | 
7 | 5 | open Mina_state  | 
8 | 6 | open Pipe_lib.Strict_pipe  | 
9 | 7 | open Network_peer  | 
 | 8 | +open Mina_stdlib  | 
 | 9 | +module Ledger = Mina_ledger.Ledger  | 
 | 10 | +module Sync_ledger = Mina_ledger.Sync_ledger  | 
10 | 11 | module Transition_cache = Transition_cache  | 
11 | 12 | 
 
  | 
12 | 13 | module type CONTEXT = sig  | 
@@ -36,27 +37,14 @@ type t =  | 
36 | 37 |   ; mutable num_of_root_snarked_ledger_retargeted : int  | 
37 | 38 |   }  | 
38 | 39 | 
 
  | 
39 |  | -type time = Time.Span.t  | 
40 |  | - | 
41 |  | -let time_to_yojson span =  | 
42 |  | -  `String (Printf.sprintf "%f seconds" (Time.Span.to_sec span))  | 
43 |  | - | 
44 |  | -type opt_time = time option  | 
45 |  | - | 
46 |  | -let opt_time_to_yojson = function  | 
47 |  | -  | Some time ->  | 
48 |  | -      time_to_yojson time  | 
49 |  | -  | None ->  | 
50 |  | -      `Null  | 
51 |  | - | 
52 | 40 | (** An auxiliary data structure for collecting various metrics for bootstrap controller. *)  | 
53 | 41 | type bootstrap_cycle_stats =  | 
54 | 42 |   { cycle_result : string  | 
55 |  | -  ; sync_ledger_time : time  | 
56 |  | -  ; staged_ledger_data_download_time : time  | 
57 |  | -  ; staged_ledger_construction_time : opt_time  | 
 | 43 | +  ; sync_ledger_time : Time.Span.t  | 
 | 44 | +  ; staged_ledger_data_download_time : Time.Span.t  | 
 | 45 | +  ; staged_ledger_construction_time : Time.Span.t option  | 
58 | 46 |   ; local_state_sync_required : bool  | 
59 |  | -  ; local_state_sync_time : opt_time  | 
 | 47 | +  ; local_state_sync_time : Time.Span.t option  | 
60 | 48 |   }  | 
61 | 49 | [@@deriving to_yojson]  | 
62 | 50 | 
 
  | 
@@ -695,7 +683,7 @@ let run ~context:(module Context : CONTEXT) ~trust_system ~verifier ~network  | 
695 | 683 |   in  | 
696 | 684 |   [%log info] "Bootstrap completed in $time_elapsed: $bootstrap_stats"  | 
697 | 685 |     ~metadata:  | 
698 |  | -      [ ("time_elapsed", time_to_yojson time_elapsed)  | 
 | 686 | +      [ ("time_elapsed", Time.Span.to_yojson_hum time_elapsed)  | 
699 | 687 |       ; ( "bootstrap_stats"  | 
700 | 688 |         , `List (List.map ~f:bootstrap_cycle_stats_to_yojson cycles) )  | 
701 | 689 |       ] ;  | 
 | 
0 commit comments