@@ -11,7 +11,7 @@ def index_rbi(index, kind, file)
1111 return unless File . exist? ( file )
1212
1313 say ( "Loading #{ kind } RBIs from #{ file } ... " )
14- time = Benchmark . realtime do
14+ time = realtime do
1515 parse_and_index_files ( index , [ file ] , number_of_workers : 1 )
1616 end
1717 say ( " Done " , :green )
@@ -27,7 +27,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
2727 else
2828 say ( "Loading #{ kind } RBIs from #{ dir } ... " )
2929 end
30- time = Benchmark . realtime do
30+ time = realtime do
3131 files = Dir . glob ( "#{ dir } /**/*.rbi" ) . sort
3232 parse_and_index_files ( index , files , number_of_workers : number_of_workers )
3333 end
@@ -39,7 +39,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
3939 def duplicated_nodes_from_index ( index , shim_rbi_dir :, todo_rbi_file :)
4040 duplicates = { }
4141 say ( "Looking for duplicates... " )
42- time = Benchmark . realtime do
42+ time = realtime do
4343 index . keys . each do |key |
4444 nodes = index [ key ]
4545 next unless shims_or_todos_have_duplicates? ( nodes , shim_rbi_dir : shim_rbi_dir , todo_rbi_file : todo_rbi_file )
@@ -283,5 +283,12 @@ def update_gem_rbis_strictnesses(errors, gem_dir)
283283 def gem_name_from_rbi_path ( path )
284284 T . must ( File . basename ( path , ".rbi" ) . split ( "@" ) . first )
285285 end
286+
287+ #: ?{ (?) -> untyped } -> Float
288+ def realtime ( &block )
289+ start = Process . clock_gettime ( Process ::CLOCK_MONOTONIC )
290+ yield
291+ Process . clock_gettime ( Process ::CLOCK_MONOTONIC ) - start
292+ end
286293 end
287294end
0 commit comments