> I happen to have an old program which uses RDTSC frequently for timing
> purposes. That seemed like a good idea at the time, but I guess it
> should be updated. The question is, what replacement is there? I don't
> want to have to use a syscall every 50 instructions or so. Feel free to
> laugh, but suggesting a workable replacement might be more helpful.
Well, you're asking me to write all the points from the documentation
in advance. Not tonight (or look up the full thread in the l-k archives,
I think I covered most)
But right now gettimeofday or clock_gettime(CLOCK_MONOTONIC) is
probably your best option. It tries to be reasonable fast depending
on hardware capabilities (and when you measure on P4
even basic RDTSC is quite slow). At least on x86-64 gettimeofday
isn't a real system call, but actually often stays in ring 3.
If you want to measure instructions in cycles in the future you can probably
use RDPMC 0, but that's not implemented yet. It won't be a replacement
for a timer for other purposes.
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]