Explorar o código

time domainslib itself

Simon Krajewski hai 5 meses
pai
achega
b0367b8bab
Modificáronse 3 ficheiros con 8 adicións e 8 borrados
  1. 3 3
      src/codegen/dump.ml
  2. 3 3
      src/context/parallel.ml
  3. 2 2
      src/filters/filters.ml

+ 3 - 3
src/codegen/dump.ml

@@ -122,7 +122,7 @@ let dump_types com pretty =
 		);
 		close()
 	in
-	Parallel.run_in_new_pool (fun pool ->
+	Parallel.run_in_new_pool com.timer_ctx (fun pool ->
 		Parallel.ParallelArray.iter pool f (Array.of_list com.types)
 	)
 
@@ -138,7 +138,7 @@ let dump_record com =
 		Buffer.add_string buf s;
 		close()
 	in
-	Parallel.run_in_new_pool (fun pool ->
+	Parallel.run_in_new_pool com.timer_ctx (fun pool ->
 		Parallel.ParallelArray.iter pool f (Array.of_list com.types)
 	)
 
@@ -163,7 +163,7 @@ let dump_position com =
 			| _ ->
 				()
 	in
-	Parallel.run_in_new_pool (fun pool ->
+	Parallel.run_in_new_pool com.timer_ctx (fun pool ->
 		Parallel.ParallelArray.iter pool f (Array.of_list com.types)
 	)
 

+ 3 - 3
src/context/parallel.ml

@@ -14,6 +14,6 @@ module ParallelSeq = struct
 		ParallelArray.iter pool f (Array.of_seq seq)
 end
 
-let run_in_new_pool f =
-	let pool = Domainslib.Task.setup_pool ~num_domains:(Domain.recommended_domain_count() - 1) () in
-	Std.finally (fun () -> Domainslib.Task.teardown_pool pool) f pool
+let run_in_new_pool timer_ctx f =
+	let pool = Timer.time timer_ctx ["domainslib";"setup"] (Domainslib.Task.setup_pool ~num_domains:(Domain.recommended_domain_count() - 1)) () in
+	Std.finally (fun () -> Timer.time timer_ctx ["domainslib";"teardown"] Domainslib.Task.teardown_pool pool) f pool

+ 2 - 2
src/filters/filters.ml

@@ -463,7 +463,7 @@ let run tctx ectx main before_destruction =
 		"check_abstract_as_value",SafeFilters.check_abstract_as_value;
 		"Tre",if defined com Define.AnalyzerOptimize then Tre.run else (fun _ e -> e);
 	] in
-	Parallel.run_in_new_pool (fun pool ->
+	Parallel.run_in_new_pool com.timer_ctx (fun pool ->
 		run_parallel_safe com scom pool (fun () ->
 			Parallel.ParallelArray.iter pool (SafeCom.run_expression_filters_safe scom detail_times filters) new_types_array
 		);
@@ -485,7 +485,7 @@ let run tctx ectx main before_destruction =
 	let alarm = Gc.create_alarm (fun () ->
 		print_endline "BAD MAJOR";
 	) in
-	let locals = Parallel.run_in_new_pool (fun pool ->
+	let locals = Parallel.run_in_new_pool com.timer_ctx (fun pool ->
 		run_parallel_safe com scom pool (fun () ->
 			Parallel.ParallelArray.iter pool (SafeCom.run_expression_filters_safe scom detail_times filters) new_types_array
 		);