Mail Archives: djgpp/1999/07/02/21:09:26
| From: | Young Fan <youngcfan AT hotmail DOT com>
|
| Newsgroups: | comp.os.msdos.djgpp
|
| Subject: | Timing
|
| Date: | Fri, 02 Jul 1999 10:08:38 -0400
|
| Organization: | Nortel
|
| Lines: | 22
|
| Message-ID: | <377CC7E6.EB82B079@hotmail.com>
|
| NNTP-Posting-Host: | pwdld0av.ca.nortel.com
|
| Mime-Version: | 1.0
|
| X-Mailer: | Mozilla 4.03 [en] (Win95; I)
|
| To: | djgpp AT delorie DOT com
|
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
| Reply-To: | djgpp AT delorie DOT com
|
Hi,
Would someone know how to use setitimer() and getitimer()? I need to
time how long it takes (to microsecond accuracy if possible, but at
least millisecond accuracy) to go through a certain for-loop.
Here's what's in include\sys\time.h:
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
int getitimer(int _which, struct itimerval *_value);
int setitimer(int _which, struct itimerval *_value, struct itimerval
*_ovalue);
What is _which and what am I supposed to put there?
I basically need to measure the elapsed time during part of the program,
without actually pausing program execution like sleep() does.
Thanks!
- Raw text -