Flow123d  jenkins-Flow123d-windows-release-multijob-285
Classes | Macros
sys_profiler.hh File Reference
#include "global_defs.h"
#include "system/system.hh"
#include <mpi.h>

Go to the source code of this file.

Classes

class  MPI_Functions
 
class  Profiler
 

Macros

#define CONSTEXPR_
 
#define _PASTE(a, b)   a ## b
 
#define PASTE(a, b)   _PASTE(a, b)
 
#define START_TIMER(tag)
 Starts a timer with specified tag. More...
 
#define END_TIMER(tag)
 Ends a timer with specified tag. More...
 
#define END_START_TIMER(tag)
 
#define ADD_CALLS(n_calls)
 Increase number of calls in actual timer. More...
 

Macro Definition Documentation

#define _PASTE (   a,
 
)    a ## b

Definition at line 91 of file sys_profiler.hh.

#define ADD_CALLS (   n_calls)

Increase number of calls in actual timer.

Some time you want to measure a performance of a cycle with body that is below resolution of the Timer implementation. If you know number of cycles, you can use this macro in following way:

1 START_TIMER("cycle");
2 unsigned int i;
3 for(i =0; i<1000000; i++) i*i*i;
4 ADD_CALLS(i);
5 END_TIMER("cycle");

In the profiler report you get the total time spent in the cycle, and time per one call which will be average time spent in the body of the cycle.

Definition at line 164 of file sys_profiler.hh.

#define CONSTEXPR_

Definition at line 83 of file sys_profiler.hh.

#define END_START_TIMER (   tag)

Ends current timer and starts the new one with given tag. Again this expands into two lines, see ATTENTION in previous macro.

Definition at line 138 of file sys_profiler.hh.

#define END_TIMER (   tag)

Ends a timer with specified tag.

Use only if you want to end timer before the end of block. Again this expands into two lines, see ATTENTION in previous macro.

Definition at line 127 of file sys_profiler.hh.

#define PASTE (   a,
 
)    _PASTE(a, b)

Definition at line 92 of file sys_profiler.hh.

#define START_TIMER (   tag)

Starts a timer with specified tag.

In fact it creates an static constant expression that identifies the point in the code and contains tag of the involved timer and its hash. Then it creates local variable that calls Profiler::start_timer() in constructor and Profiler::stop_timer() in destructor. This way the timer is automatically closed at the end of current block.

ATTENTION: This macro expands to two statements so following code is illegal:

1 if (some_condition) START_TIMER(tag);

Definition at line 114 of file sys_profiler.hh.