@@ -512,7 +512,7 @@ int finishSimulation(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
512512
513513 int retValue = 0 ;
514514 int ui ;
515- double t ;
515+ double t , total100 ;
516516
517517 SIMULATION_INFO * simInfo = data -> simulationInfo ;
518518
@@ -546,20 +546,22 @@ int finishSimulation(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
546546
547547 infoStreamPrint (LOG_STATS , 1 , "### STATISTICS ###" );
548548
549+ total100 = rt_accumulated (SIM_TIMER_TOTAL )/100.0 ;
550+
549551 infoStreamPrint (LOG_STATS , 1 , "timer" );
550552 infoStreamPrint (LOG_STATS , 0 , "%12gs reading init.xml" , rt_accumulated (SIM_TIMER_INIT_XML ));
551553 infoStreamPrint (LOG_STATS , 0 , "%12gs reading info.xml" , rt_accumulated (SIM_TIMER_INFO_XML ));
552- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] pre-initialization" , rt_accumulated (SIM_TIMER_PREINIT ), rt_accumulated (SIM_TIMER_PREINIT )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
553- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] initialization" , rt_accumulated (SIM_TIMER_INIT ), rt_accumulated (SIM_TIMER_INIT )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
554- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] steps" , rt_accumulated (SIM_TIMER_STEP ), rt_accumulated (SIM_TIMER_STEP )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
555- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] creating output-file" , rt_accumulated (SIM_TIMER_OUTPUT ), rt_accumulated (SIM_TIMER_OUTPUT )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
556- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] event-handling" , rt_accumulated (SIM_TIMER_EVENT ), rt_accumulated (SIM_TIMER_EVENT )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
557- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] overhead" , rt_accumulated (SIM_TIMER_OVERHEAD ), rt_accumulated (SIM_TIMER_OVERHEAD )/rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
554+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] pre-initialization" , rt_accumulated (SIM_TIMER_PREINIT ), rt_accumulated (SIM_TIMER_PREINIT )/total100 );
555+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] initialization" , rt_accumulated (SIM_TIMER_INIT ), rt_accumulated (SIM_TIMER_INIT )/total100 );
556+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] steps" , rt_accumulated (SIM_TIMER_STEP ), rt_accumulated (SIM_TIMER_STEP )/total100 );
557+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] creating output-file" , rt_accumulated (SIM_TIMER_OUTPUT ), rt_accumulated (SIM_TIMER_OUTPUT )/total100 );
558+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] event-handling" , rt_accumulated (SIM_TIMER_EVENT ), rt_accumulated (SIM_TIMER_EVENT )/total100 );
559+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] overhead" , rt_accumulated (SIM_TIMER_OVERHEAD ), rt_accumulated (SIM_TIMER_OVERHEAD )/total100 );
558560
559561 t = rt_accumulated (SIM_TIMER_TOTAL )- rt_accumulated (SIM_TIMER_OVERHEAD )- rt_accumulated (SIM_TIMER_EVENT )- rt_accumulated (SIM_TIMER_OUTPUT )- rt_accumulated (SIM_TIMER_STEP )- rt_accumulated (SIM_TIMER_INIT )- rt_accumulated (SIM_TIMER_PREINIT );
560- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] %s" , t , t /rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 , S_OPTIMIZATION == solverInfo -> solverMethod ? "optimization" : "simulation" );
562+ infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f%%] %s" , t , t /total100 , S_OPTIMIZATION == solverInfo -> solverMethod ? "optimization" : "simulation" );
561563
562- infoStreamPrint (LOG_STATS , 0 , "%12gs [%5.1f %%] total" , rt_accumulated (SIM_TIMER_TOTAL ), rt_accumulated ( SIM_TIMER_TOTAL )/ rt_accumulated ( SIM_TIMER_TOTAL ) * 100.0 );
564+ infoStreamPrint (LOG_STATS , 0 , "%12gs [100.0 %%] total" , rt_accumulated (SIM_TIMER_TOTAL ));
563565 messageClose (LOG_STATS );
564566
565567 infoStreamPrint (LOG_STATS , 1 , "events" );
@@ -579,11 +581,13 @@ int finishSimulation(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
579581
580582 infoStreamPrint (LOG_STATS , 1 , "solver: %s" , SOLVER_METHOD_NAME [solverInfo -> solverMethod ]);
581583 infoStreamPrint (LOG_STATS , 0 , "%5d steps taken" , solverInfo -> solverStats [0 ]);
584+
582585 infoStreamPrint (LOG_STATS , 0 , "%5d calls of functionODE" , solverInfo -> solverStats [1 ]);
586+
583587 infoStreamPrint (LOG_STATS , 0 , "%5d evaluations of jacobian" , solverInfo -> solverStats [2 ]);
588+
584589 infoStreamPrint (LOG_STATS , 0 , "%5d error test failures" , solverInfo -> solverStats [3 ]);
585590 infoStreamPrint (LOG_STATS , 0 , "%5d convergence test failures" , solverInfo -> solverStats [4 ]);
586- infoStreamPrint (LOG_STATS , 0 , "%gs time of jacobian evaluation" , rt_accumulated (SIM_TIMER_JACOBIAN ));
587591 messageClose (LOG_STATS );
588592 }
589593
@@ -594,12 +598,32 @@ int finishSimulation(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
594598 }
595599 else
596600 {
597- infoStreamPrint (LOG_STATS_V , 0 , "%5ld calls of functionODE" , data -> simulationInfo -> callStatistics .functionODE );
601+ infoStreamPrint (LOG_STATS_V , 1 , "%5ld calls of functionODE" , data -> simulationInfo -> callStatistics .functionODE );
602+ infoStreamPrint (LOG_STATS_V , 0 , "%12gs [%5.1f%%]" , rt_accumulated (SIM_TIMER_FUNCTION_ODE ), rt_accumulated (SIM_TIMER_FUNCTION_ODE )/total100 );
603+ messageClose (LOG_STATS_V );
598604 }
599- infoStreamPrint (LOG_STATS_V , 0 , "%5ld calls of functionAlgebraics" , data -> simulationInfo -> callStatistics .functionAlgebraics );
605+
606+ if (rt_ncall (SIM_TIMER_RESIDUALS )) {
607+ infoStreamPrint (LOG_STATS_V , 1 , "%5d calls of functionODE_residual" , rt_ncall (SIM_TIMER_RESIDUALS ));
608+ infoStreamPrint (LOG_STATS_V , 0 , "%12gs [%5.1f%%]" , rt_accumulated (SIM_TIMER_RESIDUALS ), rt_accumulated (SIM_TIMER_RESIDUALS )/total100 );
609+ messageClose (LOG_STATS_V );
610+ }
611+
612+ infoStreamPrint (LOG_STATS_V , 1 , "%5d calls of functionAlgebraics" , data -> simulationInfo -> callStatistics .functionAlgebraics );
613+ infoStreamPrint (LOG_STATS_V , 0 , "%12gs [%5.1f%%]" , rt_accumulated (SIM_TIMER_ALGEBRAICS ), rt_accumulated (SIM_TIMER_ALGEBRAICS )/total100 );
614+ messageClose (LOG_STATS_V );
615+
616+ infoStreamPrint (LOG_STATS_V , 1 , "%5d evaluations of jacobian" , rt_ncall (SIM_TIMER_JACOBIAN ));
617+ infoStreamPrint (LOG_STATS_V , 0 , "%12gs [%5.1f%%]" , rt_accumulated (SIM_TIMER_JACOBIAN ), rt_accumulated (SIM_TIMER_JACOBIAN )/total100 );
618+ messageClose (LOG_STATS_V );
619+
600620 infoStreamPrint (LOG_STATS_V , 0 , "%5ld calls of updateDiscreteSystem" , data -> simulationInfo -> callStatistics .updateDiscreteSystem );
601621 infoStreamPrint (LOG_STATS_V , 0 , "%5ld calls of functionZeroCrossingsEquations" , data -> simulationInfo -> callStatistics .functionZeroCrossingsEquations );
602- infoStreamPrint (LOG_STATS_V , 0 , "%5ld calls of functionZeroCrossings" , data -> simulationInfo -> callStatistics .functionZeroCrossings );
622+
623+ infoStreamPrint (LOG_STATS_V , 1 , "%5ld calls of functionZeroCrossings" , data -> simulationInfo -> callStatistics .functionZeroCrossings );
624+ infoStreamPrint (LOG_STATS_V , 0 , "%12gs [%5.1f%%]" , rt_accumulated (SIM_TIMER_ZC ), rt_accumulated (SIM_TIMER_ZC )/total100 );
625+ messageClose (LOG_STATS_V );
626+
603627 messageClose (LOG_STATS_V );
604628
605629 infoStreamPrint (LOG_STATS_V , 1 , "linear systems" );
0 commit comments