-
More precise timing
I'm running a program on a Solaris machine and need to get more accurate timing, preferably to the 1/1000th of a second. I am currently using the clock() function which returns the time since the start of the program, which for mine is less than 1/100th usually. I have looked everywhere and can't find anything.
Any help would be great for myself and probably 20 other people in my class. Thanks
-
maybe this helps?
http://www.opensolaris.org/os/articl...amming/#timers
If you wouldn't mine using asm, and don't mind using proc ticks instead of seconds, you can use rdtsc, although it's a bit shakey.
-
Try
int gettimeofday(struct timeval *tv, struct timezone *tz);
Although tv contains microsecond precision, it's accuracy is machine specific. You would need to do some local tests to find out if it was accurate enough for you.
> I'm running a program on a Solaris machine and need to get more accurate timing
Have you considered using the profiling tools (start with the -p or -pg compiler options)
> you can use rdtsc
Unless they're using solaris-x86, I don't think their processor will have this instruction.