Chombo + EB
3.0
src
BaseTools
ClockTicks.H
Go to the documentation of this file.
1
#ifdef CH_LANG_CC
2
/*
3
* _______ __
4
* / ___/ / ___ __ _ / / ___
5
* / /__/ _ \/ _ \/ V \/ _ \/ _ \
6
* \___/_//_/\___/_/_/_/_.__/\___/
7
* Please refer to Copyright.txt, in Chombo's root directory.
8
*/
9
#endif
10
11
#ifndef _CLOCKTICKS_H_
12
#define _CLOCKTICKS_H_
13
14
// (dfm 4/29/08)note that NamespaceHeader.H gets included 3x, once for
15
// each "if"...
16
17
18
#if defined(__INTEL_COMPILER) && defined(__ia64__)
19
#include <ia64intrin.h>
20
#include <ia64regs.h>
21
#include "
BaseNamespaceHeader.H
"
22
23
inline
unsigned
long
long
int
ch_ticks()
24
{
25
volatile
unsigned
long
long
int
rtn = __getReg(_IA64_REG_AR_ITC);
26
return
rtn;
27
}
28
#define CH_TICKS
29
30
#elif defined(__x86_64__) || defined(__i386__) || defined(__i686__)
31
#include "
BaseNamespaceHeader.H
"
32
33
union
clockunion
34
{
35
unsigned
int
i[2];
36
unsigned
long
long
int
l;
37
};
38
39
inline
unsigned
long
long
int
ch_ticks()
40
{
41
volatile
clockunion ret;
42
__asm__ __volatile__ (
"rdtsc"
:
"=a"
(ret.i[0]),
"=d"
(ret.i[1]));
43
return
ret.l;
44
45
// for some reason this form executes on 64, bit acts funny.
46
// unsigned long long int rtn;
47
// __asm__ __volatile__("rdtsc" : "=A"(rtn));
48
// return rtn;
49
}
50
#define CH_TICKS
51
52
#elif defined(_POWER) || defined(_POWERPC) || defined(__POWERPC__)
53
#include "
BaseNamespaceHeader.H
"
54
55
inline
unsigned
long
long
int
ch_ticks()
56
{
57
volatile
unsigned
long
long
int
tbr;
58
__asm__ __volatile__(
"mftb %[tbr]"
: [tbr]
"=r"
(tbr):);
59
return
tbr;
60
}
61
#define CH_TICKS
62
#else
63
// if we fall all the way through to here, we don't really do anything,
64
// but we still need the NamespaceHeader to balance
65
// the namespacefooter. (DFM 4/28/09)
66
#include "
BaseNamespaceHeader.H
"
67
#endif
68
69
70
#include "
BaseNamespaceFooter.H
"
71
#endif
BaseNamespaceHeader.H
BaseNamespaceFooter.H
Generated by
1.8.13