@@ -80,6 +80,7 @@ cdef perform_do_step_serial_with_downsampling(
8080 list models ,
8181 list downsampling_rates ,
8282 dict time_spent ,
83+ dict do_step_profiling ,
8384 double cur_time ,
8485 double final_time ,
8586 double step_size ,
@@ -96,7 +97,9 @@ cdef perform_do_step_serial_with_downsampling(
9697 time_start = timer ()
9798 h = min (ds_rate * step_size , abs (final_time - cur_time )) # TODO: eps adjustments here?
9899 status = model .do_step (cur_time , h , new_step )
99- time_spent [model ] += timer () - time_start
100+ time_spent_for_do_step = timer () - time_start
101+ time_spent [model ] += time_spent_for_do_step
102+ do_step_profiling [model ].append (time_spent_for_do_step )
100103 if status != 0 :
101104 raise FMUException ("The step failed for model %s at time %f. See the log for more information. Return flag %d." % (model .get_name (), cur_time , status ))
102105
@@ -470,6 +473,7 @@ cdef class Master:
470473 cdef public bool _last_step
471474 cdef public dict step_size_downsampling_factor
472475 cdef public bool _uses_step_size_downsampling
476+ cdef public dict _do_step_profiling
473477
474478 def __init__ (self , models , connections ):
475479 """
@@ -509,6 +513,7 @@ cdef class Master:
509513 "direct_dependence" : []}) for model in models )
510514 self .models_id_mapping = {str (id (model )): model for model in models }
511515 self .elapsed_time = {model : 0.0 for model in models }
516+ self ._do_step_profiling = {model : [] for model in models }
512517 self .elapsed_time_init = {model : 0.0 for model in models }
513518 self .elapsed_time ["result_handling" ] = 0.0
514519 self ._display_counter = 1
@@ -1432,6 +1437,7 @@ cdef class Master:
14321437 self .models ,
14331438 list (self .step_size_downsampling_factor .values ()),
14341439 self .elapsed_time ,
1440+ self ._do_step_profiling ,
14351441 tcur ,
14361442 final_time ,
14371443 step_size ,
@@ -1777,6 +1783,10 @@ cdef class Master:
17771783 print (' Number of global steps : %d' % self .statistics ["nsteps" ])
17781784 if self .error_controlled :
17791785 print (' Number of rejected steps : %d' % self .statistics ["nreject" ])
1786+
1787+ def get_do_step_profiling (self ):
1788+ """TODO"""
1789+ return self ._do_step_profiling
17801790
17811791 def _get_support_directional_derivatives (self ):
17821792 if self ._support_directional_derivatives == - 1 :
0 commit comments