Loading...
Searching...
No Matches
timer.h File Reference

Go to the source code of this file.

## Functions

int | startTimer (void)
void | writeTime (const char *s)
long | getTimer ()
void | startRTimer (void)
void | writeRTime (const char *s)
void | initRTimer ()
int | getRTimer ()
void | SetTimerResolution (int res)
void | SetMinDisplayTime (double mtime)

## Variables

EXTERN_VAR int | timerv
EXTERN_VAR int | rtimerv

## Function Documentation

## getRTimer()

int getRTimer | ( |  | ) |

Definition at line 150 of file timer.cc.

{
struct timeval now;
gettimeofday(&now, &tzp);
if (startRl.tv_usec > now.tv_usec)
{
now.tv_usec += 1000000;
now.tv_sec --;
}
double f =((double) (now.tv_sec - startRl.tv_sec))*timer_resolution +
((double) (now.tv_usec - startRl.tv_usec))*timer_resolution /
(double) 1000000;
return (int)(f+0.5);
}
f
FILE * f
Definition checklibs.c:9
timer_resolution
STATIC_VAR double timer_resolution
Definition timer.cc:18
startRl
STATIC_VAR struct timeval startRl
Definition timer.cc:127
tzp
STATIC_VAR struct timezone tzp
Definition timer.cc:129

## getTimer()

long getTimer | ( |  | ) |

Definition at line 80 of file timer.cc.

{
int64 curr;
getrusage(RUSAGE_SELF,&t_rec);
curr = (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
getrusage(RUSAGE_CHILDREN,&t_rec);
curr += (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
double f = ((double)curr) * timer_resolution / (double)1000000;
return (long)(f+0.5);
}
int64
long int64
Definition auxiliary.h:68
t_rec
STATIC_VAR struct rusage t_rec
Definition timer.cc:63

## initRTimer()

void initRTimer | ( |  | ) |

Definition at line 136 of file timer.cc.

{
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&startRl, &tzp);
gettimeofday(&siStartRTime, &tzp);
#else
memset(&startRl,0,sizeof(startRl));
memset(&siStartRTime,0,sizeof(siStartRTime));
#endif
}
siStartRTime
STATIC_VAR struct timeval siStartRTime
Definition timer.cc:128

## SetMinDisplayTime()

void SetMinDisplayTime | ( | double | mtime | ) |

Definition at line 27 of file timer.cc.

{
mintime = mtime;
}
mintime
STATIC_VAR double mintime
Definition timer.cc:20

## SetTimerResolution()

void SetTimerResolution | ( | int | res | ) |

Definition at line 22 of file timer.cc.

{
timer_resolution = (double) res;
}
res
CanonicalForm res
Definition facAbsFact.cc:60

## startRTimer()

void startRTimer | ( | void |  | ) |

Definition at line 131 of file timer.cc.

{
gettimeofday(&siStartRTime, &tzp);
}

## startTimer()

int startTimer | ( | void |  | ) |

Definition at line 66 of file timer.cc.

{
getrusage(RUSAGE_SELF,&t_rec);
siStartTime = (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
getrusage(RUSAGE_CHILDREN,&t_rec);
siStartTime += (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
return (int)time(NULL);
}
NULL
#define NULL
Definition omList.c:12
siStartTime
STATIC_VAR int64 siStartTime
Definition timer.cc:58

## writeRTime()

void writeRTime | ( | const char * | s | ) |

Definition at line 173 of file timer.cc.

{
struct timeval now;
gettimeofday(&now, &tzp);
if (siStartRTime.tv_usec > now.tv_usec)
{
now.tv_usec += 1000000;
now.tv_sec --;
}
double f =((double) (now.tv_sec - siStartRTime.tv_sec)) +
((double) (now.tv_usec - siStartRTime.tv_usec)) /
(double) 1000000;
if (f > mintime)
Print("//%s %.2f sec \n" ,v ,f);
}
Print
#define Print
Definition emacs.cc:80
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39

## writeTime()

void writeTime | ( | const char * | s | ) |

Definition at line 101 of file timer.cc.

{
int64 curr;
getrusage(RUSAGE_SELF,&t_rec);
curr = (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
getrusage(RUSAGE_CHILDREN,&t_rec);
curr += (int64)t_rec.ru_utime.tv_sec*1000000+(int64)t_rec.ru_utime.tv_usec
+(int64)t_rec.ru_stime.tv_sec*1000000+(int64)t_rec.ru_stime.tv_usec;
curr -= siStartTime;
double f = ((double)curr) * timer_resolution / (double)1000000;
if (f/timer_resolution > mintime)
{
#ifdef EXTEND_TIMER_D
Print("//%s %.2f/%d sec (%d) >>%s<<\n" ,v ,f,(int)timer_resolution,iiOp,my_yylinebuf);
#else
if (timer_resolution==(double)1.0)
Print("//%s %.2f sec\n" ,v ,f);
else
Print("//%s %.2f/%d sec\n" ,v ,f,(int)timer_resolution);
#endif
}
}
my_yylinebuf
VAR char my_yylinebuf[80]
Definition febase.cc:44
iiOp
VAR int iiOp
Definition iparith.cc:219

## Variable Documentation

## rtimerv

EXTERN_VAR int rtimerv

Definition at line 16 of file timer.h.

## timerv

EXTERN_VAR int timerv

Definition at line 10 of file timer.h.