CoMD
A Mini-app for Co-Design of Classical Molecular Dynamics.
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
performanceTimers.h
Go to the documentation of this file.
1
/// \file
2
/// Performance timer functions.
3
#ifndef __PERFORMANCE_TIMERS_H_
4
#define __PERFORMANCE_TIMERS_H_
5
6
#include <stdio.h>
7
8
/// Timer handles
9
enum
TimerHandle
{
totalTimer
,
loopTimer
,
timestepTimer
,
10
positionTimer
,
velocityTimer
,
redistributeTimer
,
11
atomHaloTimer
,
computeForceTimer
,
eamHaloTimer
,
12
commHaloTimer
,
commReduceTimer
,
numberOfTimers
};
13
14
/// Use the startTimer and stopTimer macros for timers in code regions
15
/// that may be performance sensitive. These can be compiled away by
16
/// defining NTIMING. If you are placing a timer anywere outside of a
17
/// tight loop, consider calling profileStart and profileStop instead.
18
///
19
/// Place calls as follows to collect time for code pieces.
20
/// Time is collected everytime this portion of code is executed.
21
///
22
/// ...
23
/// startTimer(computeForceTimer);
24
/// computeForce(sim);
25
/// stopTimer(computeForceTimer);
26
/// ...
27
///
28
#ifndef NTIMING
29
#define startTimer(handle) \
30
do \
31
{ \
32
profileStart(handle); \
33
} while(0)
34
#define stopTimer(handle) \
35
do \
36
{ \
37
profileStop(handle); \
38
} while(0)
39
#else
40
#define startTimer(handle)
41
#define stopTimer(handle)
42
#endif
43
44
/// Use profileStart and profileStop only for timers that should *never*
45
/// be turned off. Typically this means they are outside the main
46
/// simulation loop. If the timer is inside the main loop use
47
/// startTimer and stopTimer instead.
48
void
profileStart
(
const
enum
TimerHandle
handle);
49
void
profileStop
(
const
enum
TimerHandle
handle);
50
51
/// Use to get elapsed time (lap timer).
52
double
getElapsedTime
(
const
enum
TimerHandle
handle);
53
54
/// Print timing results.
55
void
printPerformanceResults
(
int
nGlobalAtoms);
56
57
/// Print timing results to Yaml file
58
void
printPerformanceResultsYaml
(FILE* file);
59
#endif
performanceTimers.h
Generated on Wed Jun 5 2013 11:08:31 for CoMD by
1.8.3.1