Mail Archives: djgpp/1999/07/06/21:00:46.1
Hi,
Thanks for your help. I've been trying to solve this problem for a whole
week. There are very few comments in the DGJPP include files, so I was
wondering if you tell me how to use both the uclock and the timestamp
counter. This is what I found for uclock in sys/time.h:
#include <sys/types.h>
typedef long long uclock_t;
#define UCLOCKS_PER_SEC 1193180
int gettimeofday(struct timeval *_tp, struct timezone *_tzp);
unsigned long rawclock(void);
int select(int _nfds, fd_set *_readfds, fd_set *_writefds, fd_set
*_exceptfds, struct timeval *_timeout);
int settimeofday(struct timeval *_tp, ...);
uclock_t uclock(void);
Would I still run into problems with Windows about this if I restarted
in MS-DOS mode?
If the uclock doesn't work, how would I use the CPU's timestamp counter?
Thanks a lot.
Young Fan wrote:
>
> 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 -