51 if ( cmode == RESET ) {
59 gettimeofday(&(ptt->
rutim), NULL);
61 QueryPerformanceCounter(&ptt->
rutim);
64 FileTimeToSystemTime(&ptt->
ftSys , &ptt->
stSys );
71 getrusage(RUSAGE_SELF,&(ptt->ru));
72 ptt->
rutim = ptt->ru.ru_utime;
74 ptt->
rutim = ptt->ru.ru_stime;
79 ptt->
uini = ((double)ptt->
stUser.wHour * 3600 + (
double)ptt->
stUser.wMinute * 60
80 + (double)ptt->
stUser.wSecond) *
BIG + (double)ptt->
stUser.wMilliseconds * 1000;
81 ptt->
sini = ((
double)ptt->
stSys.wHour * 3600 + (double)ptt->
stSys.wMinute * 60
82 + (
double)ptt->
stSys.wSecond) *
BIG + (
double)ptt->
stSys.wMilliseconds * 1000;
85 else if ( cmode == OFF ) {
89 getrusage(RUSAGE_SELF,&(ptt->ru));
90 ptt->
rutim = ptt->ru.ru_utime;
92 ptt->
rutim = ptt->ru.ru_stime;
97 ptt->
uend = ((double)ptt->
stUser.wHour * 3600 + (
double)ptt->
stUser.wMinute * 60
98 + (double)ptt->
stUser.wSecond) *
BIG + (double)ptt->
stUser.wMilliseconds * 1000;
99 ptt->
send = ((
double)ptt->
stSys.wHour * 3600 + (double)ptt->
stSys.wMinute * 60
100 + (
double)ptt->
stSys.wSecond) *
BIG + (
double)ptt->
stSys.wMilliseconds * 1000;
125 QueryPerformanceFrequency(&t[0].frequency);
128 for (k = 1; k < maxtim; k++) {
133 for (k=0; k<maxtim; k++) {
142#ifdef MMG_COMPARABLE_OUTPUT
149void printim(
double elps,
char *stim) {
164 sprintf(stim,
"%5.3lfs",elps);
165 else if ( elps < 3600.0 ) {
166 mm = (int)(elps / 60.0);
167 ss = (int)elps - mm * 60;
168 sprintf(stim,
"%dm%ds (%7.3lfs)",mm,ss,elps);
171 hh = (int)(elps / 3600);
172 mm = (int)((elps - hh*3600) / 60);
173 ss = (int)(elps - mm*60 - hh*3600);
174 sprintf(stim,
"%dh%dm%ds",hh,mm,ss);
void tminit(mytime *t, int maxtim)
Initialize mytime object.
void printim(double elps, char *stim)
Print real time.
void chrono(int cmode, mytime *ptt)
Function to measure time.