Go to the documentation of this file.
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)
unsigned long long getCount() const
Get the total number of times start/stop is done.
double getReal() const
Get the real time (in seconds).
void stop()
Stop the timer.
void reset()
Reset the timer to zero.
Precision timer to measure elapsed times in a cumulative way.
void start()
Restart the timer.
void print_time(std::ostream &, double time) const
this file contains all the compiler specific defines
void show(std::ostream &os) const
void show() const
Show real time on cout or a user supplied stream.
static double CPU_speed_in_MHz
TableExprNode time(const TableExprNode &node)
void show(std::ostream &os, const String &prefix) const
String: the storage and methods of handling collections of characters.
void show(const String &) const
Show real time on cout or a user supplied stream preceeded by the string parameter.
static double get_CPU_speed_in_MHz()