xref: /petsc/src/sys/perfstubs/timer_f.h (revision df4cd43f92eaa320656440c40edb1046daee8f75)
1 ! Copyright (c) 2019-2020 University of Oregon
2 ! Distributed under the BSD Software License
3 ! (See accompanying file LICENSE.txt)
4 
5 #ifdef PERFSTUBS_USE_TIMERS
6 
7 !
8 !    Macro API for option of entirely disabling at compile time
9 !    To use this API, set the Macro PERFSTUBS_USE_TIMERS on the command
10 !    line or in a config.h file, however your project does it
11 !
12 
13 #define PERFSTUBS_INITIALIZE() call ps_initialize()
14 #define PERFSTUBS_FINALIZE() call ps_finalize()
15 #define PERFSTUBS_DUMP_DATA() call ps_dump_data()
16 #define PERFSTUBS_REGISTER_THREAD() call ps_register_thread()
17 #define PERFSTUBS_TIMER_CREATE(_timer_object, _timer_name) \
18     call ps_timer_create_fortran(_timer_object, _timer_name//CHAR(0))
19 #define PERFSTUBS_TIMER_START(_timer_object) \
20     call ps_timer_start_fortran(_timer_object)
21 #define PERFSTUBS_TIMER_STOP(_timer_object) \
22     call ps_timer_stop_fortran(_timer_object)
23 #define PERFSTUBS_SET_PARAMETER(_parameter_name, parameter_value) \
24     call ps_set_parameter(_parameter_name//CHAR(0), parameter_value)
25 #define PERFSTUBS_DYNAMIC_PHASE_START(_phase_prefix, _iteration_index) \
26     call ps_dynamic_phase_start(_phase_prefix//CHAR(0), _iteration_index)
27 #define PERFSTUBS_DYNAMIC_PHASE_STOP(_phase_prefix, _iteration_index) \
28     call ps_dynamic_phase_stop(_phase_prefix//CHAR(0), _iteration_index)
29 #define PERFSTUBS_CREATE_COUNTER(_counter_object, _name) \
30     call ps_create_counter_fortran(_counter_object, _name//CHAR(0))
31 #define PERFSTUBS_SAMPLE_COUNTER(_counter_object, _value) \
32     call ps_sample_counter_fortran(_counter_object, _value)
33 #define PERFSTUBS_METADATA(_name, _value) \
34     call ps_set_metadata(_name//CHAR(0), _value//CHAR(0))
35 
36 ! // defined(PERFSTUBS_USE_TIMERS)
37 #else
38 
39 #define PERFSTUBS_INIT()
40 #define PERFSTUBS_DUMP_DATA()
41 #define PERFSTUBS_REGISTER_THREAD()
42 #define PERFSTUBS_TIMER_CREATE(_timer_object, _timer_name)
43 #define PERFSTUBS_TIMER_START(_timer_object)
44 #define PERFSTUBS_TIMER_STOP(_timer_object)
45 #define PERFSTUBS_SET_PARAMETER(_parameter_name, _parameter_value)
46 #define PERFSTUBS_DYNAMIC_PHASE_START(_phase_prefix, _iteration_index)
47 #define PERFSTUBS_DYNAMIC_PHASE_STOP(_phase_prefix, _iteration_index)
48 #define PERFSTUBS_TIMER_START_FUNC()
49 #define PERFSTUBS_TIMER_STOP_FUNC()
50 #define PERFSTUBS_CREATE_COUNTER(_counter_object, _name)
51 #define PERFSTUBS_SAMPLE_COUNTER(_counter_object, _value)
52 #define PERFSTUBS_METADATA(_name, _value)
53 
54 ! // defined(PERFSTUBS_USE_TIMERS)
55 #endif
56 
57