Open DanielGibson opened 12 years ago
This issue raises a number of questions.
Ok, first I'm dubious about a solution that that involves embedded asm. Shouldn't there be a library call that does about the same thing.
Second, A quick look over the rest of the code raises questions about this code's ablity to handle modern CPUs with dynamic frequency scaling. Once again, Library call....
Third, Why am I not subscribed to the mailing list? I'm sure I signed up after it was first setup, before there were any posts. Anyway I should be signed up now.
I don't know of any library, but maybe there is a solution. It should be able to handle dynamic frequency scaling at least on some CPUs that support it, but it may not handle multiple cores well..
This code seems to be used mostly in profiling (through idTimer) and even then it's almost always used to calculate a time (by dividing through the frequency) I think. It would probably be better if idTimer used Sys_GetMilliseconds() or something like that.
Anyway: the code I posted is less buggy then the one currently used and behaves like the original code for x86.
https://github.com/phire/doom3.gpl/blob/master/neo/sys/linux/main.cpp#L259 This code doesn't work. (Probably because unsigned long is 64bits long on Linux/amd64, but rdtsc uses uint32_t values). Use the following (from Kai Blaschke in the iodoom3 mailing list) instead:
Cheers,