36 #ifndef MADNESS_WORLD_WORLDTIME_H__INCLUDED 
   37 #define MADNESS_WORLD_WORLDTIME_H__INCLUDED 
   46 #include <catamount/dclock.h> 
   50 #  define BG_CYCLES_PER_MICROSECOND 850 
   51 #  define BG_SECONDS_PER_CYCLE 1.176470588235294033e-09 
   52 #  include </bgsys/drivers/ppcfloor/arch/include/bpcore/ppc450_inlines.h> 
   56 #  define BG_CYCLES_PER_MICROSECOND 1600 
   57 #  define BG_SECONDS_PER_CYCLE 6.25e-10 
   58 #  include <hwi/include/bqc/A2_inlines.h> 
   79     static inline uint64_t cycle_count() {
 
   81 #if defined(HAVE_IBMBGP) 
   82      unsigned int rx, ry, rz;
 
   85          asm volatile ( 
"mftbu %0" : 
"=r"(rx) );
 
   86          asm volatile ( 
"mftb %0" : 
"=r"(ry) );
 
   87          asm volatile ( 
"mftbu %0" : 
"=r"(rz) );
 
   92 #elif defined(HAVE_IBMBGQ) 
   96 __asm__ 
volatile(
".byte 0x0f, 0x31" : 
"=A"(x));
 
   99 __asm__ 
volatile(
"rdtsc" : 
"=a"(
a), 
"=d"(d));
 
  100         x = ((uint64_t)a) | (((uint64_t)d)<<32);
 
  124     static inline double cpu_time() {
 
  125 #if defined(X86_32) || defined(X86_64) || defined(HAVE_IBMBGP) 
  127         return cycle_count()*rfreq;
 
  130 #elif defined(HAVE_IBMBGP) 
  131         return BG_SECONDS_PER_CYCLE * _bgp_GetTimeBase();
 
  132 #elif defined(HAVE_IBMBGQ) 
  133         return BG_SECONDS_PER_CYCLE * GetTimeBase();
 
  135         return double(clock())/CLOCKS_PER_SEC;
 
  142 #if defined(X86_32) || defined(X86_64) 
  143         asm volatile(
"rep;nop" : : : 
"memory");
 
  144 #elif defined(HAVE_IBMBGP) 
  148         asm volatile (
"nop\n"); 
 
  149 #elif defined(HAVE_IBMBGQ) 
  152         asm volatile (
"nop\n");
 
  155 #error cpu_relax is not implemented! 
  163     static inline void myusleep(
unsigned int us) {
 
  164 #if defined(HAVE_CRAYXT) 
  165         double secs = us*1e-6;
 
  166         double start = cpu_time();
 
  167         while (cpu_time()-start < secs) {
 
  170 #elif defined(HAVE_IBMBGP) || defined(HAVE_IBMBGQ) 
  171         int count = BG_CYCLES_PER_MICROSECOND*us;
 
  172         for (
int i=0; i<count; i++) {
 
  173             asm volatile (
"nop\n");
 
  182 #endif // MADNESS_WORLD_WORLDTIME_H__INCLUDED 
void cpu_relax()
Do nothing and especially do not touch memory. 
Definition: worldtime.h:141
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
double cpu_frequency()
Estimates frequency of the processor in Hz. 
Definition: world.cc:279
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces. 
Definition: chem/atomutil.cc:45
double wall_time()
Returns the wall time in seconds relative to arbitrary origin. 
Definition: world.cc:248