26#ifndef CASA_PRECTIMER_H
27#define CASA_PRECTIMER_H
29#include <casacore/casa/aips.h>
33#if defined __ia64__ && defined __INTEL_COMPILER
115 void show(std::ostream& os)
const;
129 unsigned long long getCount()
const;
146#if defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
148 int count_low, count_high;
151 unsigned long long count;
179#if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
183 "leaq (%%rax,%%rdx),%%rax\n\t"
185 :
"+m"(
u1.total_time)
188#elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
191 "lock;subl %%eax,%0\n\t"
193 :
"+m"(
u1.s1.total_time_low),
"+m"(
u1.s1total_time_high)
196#elif (defined __i386__ || defined __x86_64__) && \
197 (defined __PATHSCALE__ || (defined __APPLE__ && defined __APPLE_CC__ && __APPLE_CC__ == 5531))
200 asm volatile(
"rdtsc" :
"=a"(eax),
"=d"(edx));
202 u1.total_time -= ((
unsigned long long)edx << 32) + eax;
203#elif (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __INTEL_COMPILER)
208 :
"+m"(
u1.s1.total_time_low),
"+m"(
u1.s1.total_time_high)
211#elif defined __ia64__ && defined __INTEL_COMPILER
212 u1.total_time -= __getReg(_IA64_REG_AR_ITC);
213#elif defined __ia64__ && defined __GNUC__
215 asm volatile(
"mov %0=ar.itc" :
"=r"(
time));
217#elif defined __PPC__ && (defined __GNUC__ || defined __xlC__)
218 int high, low, retry;
228 :
"=r"(high),
"=r"(low),
"=r"(retry),
"=r"(
u1.s1.total_time_low),
"=r"(
u1.s1.total_time_high)
229 :
"3"(
u1.s1.total_time_low),
"4"(
u1.s1.total_time_high));
234#if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
238 "leaq (%%rax,%%rdx),%%rax\n\t"
240 :
"+m"(
u1.total_time)
243#elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
246 "lock;addl %%eax, %0\n\t"
247 "lock;adcl %%edx, %1"
248 :
"+m"(
u1.s1.total_time_low),
"+m"(
u1.s1.total_time_high)
251#elif (defined __i386__ || defined __x86_64__) && \
252 (defined __PATHSCALE__ || (defined __APPLE__ && defined __APPLE_CC__ && __APPLE_CC__ == 5531))
255 asm volatile(
"rdtsc\n\t" :
"=a"(eax),
"=d"(edx));
256 u1.total_time += ((
unsigned long long)edx << 32) + eax;
257#elif (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __INTEL_COMPILER)
262 :
"+m"(
u1.s1.total_time_low),
"+m"(
u1.s1.total_time_high)
265#elif defined __ia64__ && defined __INTEL_COMPILER
266 u1.total_time += __getReg(_IA64_REG_AR_ITC);
267#elif defined __ia64__ && defined __GNUC__
269 asm volatile(
"mov %0=ar.itc" :
"=r"(
time));
271#elif defined __PPC__ && (defined __GNUC__ || defined __xlC__)
272 int high, low, retry;
282 :
"=r"(high),
"=r"(low),
"=r"(retry),
"=r"(
u1.s1.total_time_low),
"=r"(
u1.s1.total_time_high)
283 :
"3"(
u1.s1.total_time_low),
"4"(
u1.s1.total_time_high));
286#if defined __x86_64__ && defined __INTEL_COMPILER && defined _OPENMP
287 asm volatile(
"lock;addq $1,%0" :
"+m"(
u2.count));
288#elif defined __i386__ && defined __INTEL_COMPILER && defined _OPENMP
290 "lock;addl $1,%0\n\t"
292 :
"+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.
For temporary backward namespace compatibility, use casa as alias for casacore.
TableExprNode time(const TableExprNode &node)