38#ifndef MADNESS_WORLD_TIMERS_H__INCLUDED
39#define MADNESS_WORLD_TIMERS_H__INCLUDED
49#include <catamount/dclock.h>
53# define BG_CYCLES_PER_MICROSECOND 850
54# define BG_SECONDS_PER_CYCLE 1.176470588235294033e-09
55# include </bgsys/drivers/ppcfloor/arch/include/bpcore/ppc450_inlines.h>
59# define BG_CYCLES_PER_MICROSECOND 1600
60# define BG_SECONDS_PER_CYCLE 6.25e-10
61# include <hwi/include/bqc/A2_inlines.h>
83#if defined(HAVE_IBMBGP)
84 unsigned int rx, ry, rz;
87 asm volatile (
"mftbu %0" :
"=r"(rx) );
88 asm volatile (
"mftb %0" :
"=r"(ry) );
89 asm volatile (
"mftbu %0" :
"=r"(rz) );
94#elif defined(HAVE_IBMBGQ)
98 __asm__
volatile(
".byte 0x0f, 0x31" :
"=A"(x));
101 __asm__
volatile(
"rdtsc" :
"=a"(
a),
"=d"(
d));
102 x = ((uint64_t)
a) | (((uint64_t)
d)<<32);
128#if defined(X86_32) || defined(X86_64) || defined(HAVE_IBMBGP)
133#elif defined(HAVE_IBMBGP)
134 return BG_SECONDS_PER_CYCLE * _bgp_GetTimeBase();
135#elif defined(HAVE_IBMBGQ)
136 return BG_SECONDS_PER_CYCLE * GetTimeBase();
138 const auto now = std::chrono::steady_clock::now();
139 const auto nanoseconds_since_epoch = std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count();
140 return nanoseconds_since_epoch / 1e9;
149#if defined(X86_32) || defined(X86_64)
150 asm volatile(
"rep;nop" : : :
"memory");
151#elif defined(HAVE_IBMBGP) || defined(HAVE_IBMBGQ)
152 asm volatile (
"nop\n");
156 asm volatile (
"nop\n");
165#if defined(HAVE_CRAYXT)
166 double secs = us*1
e-6;
171#elif defined(HAVE_IBMBGP) || defined(HAVE_IBMBGQ)
172 int count = BG_CYCLES_PER_MICROSECOND*us;
173 for (
int i=0; i<count; i++) {
174 asm volatile (
"nop\n");
Macros and tools pertaining to the configuration of MADNESS.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
static double cpu_time()
Returns the cpu time in seconds relative to an arbitrary origin.
Definition timers.h:127
static void myusleep(unsigned int us)
Sleep or spin for specified number of microseconds.
Definition timers.h:164
double cpu_frequency()
Estimate the processor frequency, in Hz.
Definition timers.cc:79
double wall_time()
Returns the wall time in seconds relative to an arbitrary origin.
Definition timers.cc:48
void cpu_relax()
Do nothing and especially do not touch memory.
Definition timers.h:148
static uint64_t cycle_count()
On some machines we have access to a cycle count.
Definition timers.h:81
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
void e()
Definition test_sig.cc:75