28 #ifndef CASA_PRECTIMER_H
29 #define CASA_PRECTIMER_H
32 #include <casacore/casa/aips.h>
36 #if defined __ia64__ && defined __INTEL_COMPILER
120 void show (std::ostream& os)
const;
134 unsigned long long getCount()
const;
151 #if defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
153 int count_low, count_high;
156 unsigned long long count;
196 #if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
201 "leaq (%%rax,%%rdx),%%rax\n\t"
209 #elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
213 "lock;subl %%eax,%0\n\t"
221 #elif (defined __i386__ || defined __x86_64__) && (defined __PATHSCALE__ || (defined __APPLE__ && defined __APPLE_CC__ && __APPLE_CC__ == 5531))
224 asm volatile (
"rdtsc" :
"=a" (eax),
"=d" (edx));
226 u1.
total_time -= ((
unsigned long long) edx << 32) + eax;
227 #elif (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __INTEL_COMPILER)
239 #elif defined __ia64__ && defined __INTEL_COMPILER
241 #elif defined __ia64__ && defined __GNUC__
243 asm volatile (
"mov %0=ar.itc" :
"=r" (
time));
245 #elif defined __PPC__ && (defined __GNUC__ || defined __xlC__)
246 int high, low, retry;
259 "=r" (high),
"=r" (low),
"=r" (retry),
270 #if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
275 "leaq (%%rax,%%rdx),%%rax\n\t"
283 #elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
287 "lock;addl %%eax, %0\n\t"
288 "lock;adcl %%edx, %1"
295 #elif (defined __i386__ || defined __x86_64__) && (defined __PATHSCALE__ || (defined __APPLE__ && defined __APPLE_CC__ && __APPLE_CC__ == 5531))
298 asm volatile (
"rdtsc\n\t" :
"=a" (eax),
"=d" (edx));
299 u1.
total_time += ((
unsigned long long) edx << 32) + eax;
300 #elif (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __INTEL_COMPILER)
312 #elif defined __ia64__ && defined __INTEL_COMPILER
314 #elif defined __ia64__ && defined __GNUC__
316 asm volatile (
"mov %0=ar.itc" :
"=r" (
time));
318 #elif defined __PPC__ && (defined __GNUC__ || defined __xlC__)
319 int high, low, retry;
332 "=r" (high),
"=r" (low),
"=r" (retry),
339 #if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
340 asm volatile (
"lock;addq $1,%0" :
"+m" (
u2.
count));
341 #elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
344 "lock;addl $1,%0\n\t"
347 "+m" (
u2.s2.count_low),
"+m" (
u2.s2.count_high)
static double CPU_speed_in_MHz
void show(std::ostream &os, const String &prefix) const
void reset()
Reset the timer to zero.
void start()
Restart the timer.
void show(std::ostream &os) const
unsigned long long getCount() const
Get the total number of times start/stop is done.
static double get_CPU_speed_in_MHz()
void show(const String &) const
Show real time on cout or a user supplied stream preceeded by the string parameter.
void print_time(std::ostream &, double time) const
double getReal() const
Get the real time (in seconds).
void stop()
Stop the timer.
void show() const
Show real time on cout or a user supplied stream.
String: the storage and methods of handling collections of characters.
this file contains all the compiler specific defines
TableExprNode time(const TableExprNode &node)