#include "cs_defs.h"
#include "cs_timer.h"
#include "cs_time_plot.h"
Go to the source code of this file.
|
| void | cs_timer_stats_initialize (void) |
| | Initialize timer statistics handling.
|
| void | cs_timer_stats_finalize (void) |
| | Finalize timer statistics handling.
|
| void | cs_timer_stats_set_start_time (int time_id) |
| | Set a start time for time stats.
|
| void | cs_timer_stats_set_plot_options (cs_time_plot_format_t format, int frequency, int n_buffer_steps, double flush_wtime) |
| | Set global timer statistics plot options.
|
| void | cs_timer_stats_increment_time_step (void) |
| | Increment time step for timer statistics.
|
| int | cs_timer_stats_create (const char *parent_name, const char *name, const char *label) |
| | Create a timer statistics structure.
|
| int | cs_timer_stats_id_by_name (const char *name) |
| | Return the id of a defined statistic based on its name.
|
| void | cs_timer_stats_set_plot (int id, int plot) |
| | Enable or disable plotting for a timer statistic.
|
| int | cs_timer_stats_is_active (int id) |
| | indicate if a timer for a given statistic is currently active.
|
| void | cs_timer_stats_start (int id) |
| | Start a timer for a given statistic.
|
| void | cs_timer_stats_stop (int id) |
| | Stop a timer for a given statistic.
|
| int | cs_timer_stats_switch (int id) |
| | Start a timer for a given statistic, stopping previous timers of the same type which are not a parent, and starting inactive parent timers if necessary.
|
| void | cs_timer_stats_add_diff (int id, const cs_timer_t *t0, const cs_timer_t *t1) |
| | Add a timing range to an inactive timer.
|
| void | cs_timer_stats_define_defaults (void) |
| | Define default timer statistics.
|
◆ cs_timer_stats_add_diff()
Add a timing range to an inactive timer.
This does not modify parent timers, so consistency of active and inactive timers must be ensured by the caller.
- Parameters
-
| [in] | id | id of statistic |
| [in] | t0 | oldest timer value |
| [in] | t1 | most recent timer value |
◆ cs_timer_stats_create()
| int cs_timer_stats_create |
( |
const char * | parent_name, |
|
|
const char * | name, |
|
|
const char * | label ) |
Create a timer statistics structure.
- Parameters
-
| [in] | parent_name | name of parent statistic, or NULL |
| [in] | name | associated canonical name |
| [in] | label | associated label, or NULL |
- Returns
- id of new timer stats structure
- Parameters
-
| [in] | parent_name | name of parent statistic, or nullptr |
| [in] | name | associated canonical name |
| [in] | label | associated label, or nullptr |
- Returns
- id of new timer stats structure
◆ cs_timer_stats_define_defaults()
| void cs_timer_stats_define_defaults |
( |
void | | ) |
|
Define default timer statistics.
This creates 2 statistic timer trees, whose roots ids are:
- 0 for computational operations
- 1 for computational stages
◆ cs_timer_stats_finalize()
| void cs_timer_stats_finalize |
( |
void | | ) |
|
Finalize timer statistics handling.
◆ cs_timer_stats_id_by_name()
| int cs_timer_stats_id_by_name |
( |
const char * | name | ) |
|
Return the id of a defined statistic based on its name.
If no timer with the given name exists, -1 is returned.
- Parameters
-
- Returns
- id of the statistic, or -1 if not found
If no timer with the given name exists, -1 is returned.
- Parameters
-
- Returns
- id of the statistic, or -1 if not found
◆ cs_timer_stats_increment_time_step()
| void cs_timer_stats_increment_time_step |
( |
void | | ) |
|
Increment time step for timer statistics.
◆ cs_timer_stats_initialize()
| void cs_timer_stats_initialize |
( |
void | | ) |
|
Initialize timer statistics handling.
This creates 2 statistic timer trees, whose roots ids are:
- 0 for computational operations
- 1 for computational stages
◆ cs_timer_stats_is_active()
| int cs_timer_stats_is_active |
( |
int | id | ) |
|
indicate if a timer for a given statistic is currently active.
- Parameters
-
- Returns
- 1 if active, 0 otherwise
◆ cs_timer_stats_set_plot()
| void cs_timer_stats_set_plot |
( |
int | id, |
|
|
int | plot ) |
Enable or disable plotting for a timer statistic.
By default plotting is enabled for all statistics, except root statistic 1 (as it measures the same total time as root 0, with a different subtree).
This function is only effective before the first call to cs_timer_stats_increment_time_step.
- Parameters
-
| [in] | id | id of statistic |
| [in] | plot | 0 to disable, 1 to enable |
◆ cs_timer_stats_set_plot_options()
| void cs_timer_stats_set_plot_options |
( |
cs_time_plot_format_t | format, |
|
|
int | frequency, |
|
|
int | n_buffer_steps, |
|
|
double | flush_wtime ) |
Set global timer statistics plot options.
This function is only effective before the first call to cs_timer_stats_increment_time_step.
- Parameters
-
| [in] | format | associated file format |
| [in] | frequency | plot every n time steps |
| [in] | n_buffer_steps | number of time steps in output buffer if file is not to be kept open |
| [in] | flush_wtime | elapsed time interval between file flushes (if < 0, no forced flush) |
◆ cs_timer_stats_set_start_time()
| void cs_timer_stats_set_start_time |
( |
int | time_id | ) |
|
Set a start time for time stats.
This is useful to shift the time id for restarts. This function must not be called after cs_timer_stats_increment_time_step.
- Parameters
-
| [in] | time_id | associated starting time id |
◆ cs_timer_stats_start()
| void cs_timer_stats_start |
( |
int | id | ) |
|
Start a timer for a given statistic.
Parents of the current statistic are also started, if not active.
If a timer with the same root but different parents is active, we assume the current operation is a subset of the active timer, so the timer is not started, so as to avoid having a sum of parts larger than the total.
- Parameters
-
◆ cs_timer_stats_stop()
| void cs_timer_stats_stop |
( |
int | id | ) |
|
Stop a timer for a given statistic.
Children of the current statistic are also stopped, if active.
- Parameters
-
◆ cs_timer_stats_switch()
| int cs_timer_stats_switch |
( |
int | id | ) |
|
Start a timer for a given statistic, stopping previous timers of the same type which are not a parent, and starting inactive parent timers if necessary.
- Parameters
-
- Returns
- id of previously active statistic, or -1 in case of error
- Parameters
-
| [in] | id | id of statistic with same root |
- Returns
- id of previously active statistic, or -1 in case of error