# Performance and time¶

XGC outputs timing_#########.* files where ######### is the time step, which are used to analyze the performance. The output frequency is controlled by the input parameters mon_flush_count and mon_flush_freq.

The current time step (from which the simulation will be restarted) and the number of restarts are written in timestep.dat.

The files timing_#########.txt_stats contain information on the time spent in different sections during execution of the time step. The sections are set by timers in the code:

Fortran

use perf_monitor

call t_startf("REGION_1") !start timer
! execute region 1
call t_stopf("REGION_1") !stop timer


C++

#include "gptl.h"

int ierr; //error code

ierr = GPTLstart("REGION_2"); //start timer
// execute region 2
ierr = GPTLstop("REGION_2"); //stop timer


There is also a TIMER macro that can be used to time a single function:

#include "timer_macro.hpp"

TIMER("MY_FUNCTION", my_func() );


When developing code it is useful to add your own timers to check the performance.