forked from applied-numerical-algorithms-group-lbnl/Chombo_4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChombo_CH_Timer.H
62 lines (49 loc) · 1.52 KB
/
Chombo_CH_Timer.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifdef CH_LANG_CC
/*
* _______ __
* / ___/ / ___ __ _ / / ___
* / /__/ _ \/ _ \/ V \/ _ \/ _ \
* \___/_//_/\___/_/_/_/_.__/\___/
* Please refer to Copyright.txt, in Chombo's root directory.
*/
#endif
#ifndef _Chombo_CH_TIMER_H_
#define _Chombo_CH_TIMER_H_
#include "Proto_Timer.H"
#include "Chombo_SPMD.H"
#define CH_TIMER(name, tpointer) PR_TIMER(name, tpointer)
#define CH_TIME(name) PR_TIME(name)
#define CH_FLOPS(flops) PR_FLOPS(flops)
#define CH_TIMELEAF(name) PR_TIMELEAF(name)
#define CH_TIMERS(name) PR_TIMERS(name)
#define CH_START(tpointer) PR_START(tpointer)
#define CH_STOP(tpointer) PR_STOP(tpointer)
#define CH_TIMER_REPORT() PR_TIMER_REPORT()
#define CH_TIMER_RESET() PR_TIMER_RESET()
#define CH_TIMER_PRUNE(threshold) PR_TIMER_PRUNE(threshold)
inline void CH_TIMER_SETFILE(const char* a_prefix_string = "chombo.time.table")
{
#ifndef CH_MPI
std::string name(a_prefix_string);
#else
char char_str[1024];
int outInterv = 1;
char* charInterv = getenv("CH_OUTPUT_INTERVAL");
if (charInterv != NULL)
{
outInterv = atoi(charInterv);
}
int thisProc = CH4_SPMD::procID();
if ((thisProc % outInterv) != 0)
{
sprintf(char_str,"/dev/null");
}
else
{
sprintf(char_str, "%s.%d",a_prefix_string, CH4_SPMD::procID());
}
std::string name(char_str);
#endif
PR_TIMER_SETFILE(name.c_str());
}
#endif // CH_TIMER_H