Is ClockCycle() safe in interrupt handle in Pentium or Celer

I have programmed an interrupt handle program in Pentium III866 cpu (QNX
6.1.0a).
In the interrupt handle function ,I use the ClockCycles() function to get
count(something relate to the time),it works ok(no crash).it seems safe to
use in interrupt handler in Pentium CPU .

I search the docs on qnx web about ClockCycles() for qnx6.1.0,it says
that the function is safety in interrupt handler.
And it says that it depends on the cpu style—“x86 has the RDTSC
instruction”.

Now we will select new computer which has “CPU Celeron 800” to running
the same program(interrupt program).I don’t know whether it is safe to use
ClockCycles() in interrupt handler on that cpu style,if I still use
Qnx6.1.0a. By the way, if the cpu is AMD ,is it safe to to use ClockCycles()
in interrupt handler?

In Qnx6.2.1 online help,it said that the function ClockCycles() is not
safe in interrupt handler.
If I use the new system Qnx6.2.x ,it seems that we can’t use the
ClockCycles() in interrupt handler. Does it really not safe to use
ClockCycles() in interrupt handler on Pentium or Celeron or AMD cpu?


3.
If I can’t use ClockCycles() in interrupt handler,how to program to get
the current time of the interrupt in interrupt handler?


Any advice.

I believe that any Pentium class system will work fine with the RDTSC
instruction. I also believe that the docs are just being overly cautious
since this may not be safe on all CPU types, they just mark it as not
interrupt safe. That way they won’t have to explain why it didn’t work
when you port to another CPU.

I would go ahead and continue to use the ClockCycles() call. If it works
you’re fine. If it doesn’t, then I was wrong.


zhz <zhz_zhang26@sina.com> wrote:
z > I have programmed an interrupt handle program in Pentium III866 cpu (QNX
z > 6.1.0a).
z > In the interrupt handle function ,I use the ClockCycles() function to get
z > count(something relate to the time),it works ok(no crash).it seems safe to
z > use in interrupt handler in Pentium CPU .

z > 1.
z > I search the docs on qnx web about ClockCycles() for qnx6.1.0,it says
z > that the function is safety in interrupt handler.
z > And it says that it depends on the cpu style—“x86 has the RDTSC
z > instruction”.

z > Now we will select new computer which has “CPU Celeron 800” to running
z > the same program(interrupt program).I don’t know whether it is safe to use
z > ClockCycles() in interrupt handler on that cpu style,if I still use
z > Qnx6.1.0a. By the way, if the cpu is AMD ,is it safe to to use ClockCycles()
z > in interrupt handler?

z > 2.
z > In Qnx6.2.1 online help,it said that the function ClockCycles() is not
z > safe in interrupt handler.
z > If I use the new system Qnx6.2.x ,it seems that we can’t use the
z > ClockCycles() in interrupt handler. Does it really not safe to use
z > ClockCycles() in interrupt handler on Pentium or Celeron or AMD cpu?


z > 3.
z > If I can’t use ClockCycles() in interrupt handler,how to program to get
z > the current time of the interrupt in interrupt handler?

“Bill Caroselli” <qtps@earthlink.net> дÈëÏûÏ¢ÐÂÎÅ
:c4rjor$i3i$1@inn.qnx.com

I believe that any Pentium class system will work fine with the RDTSC
instruction. I also believe that the docs are just being overly cautious
since this may not be safe on all CPU types, they just mark it as not
interrupt safe. That way they won’t have to explain why it didn’t work
when you port to another CPU.

I would go ahead and continue to use the ClockCycles() call. If it works
you’re fine. If it doesn’t, then I was wrong.

what does “any Pentium class system” mean?

Does It only include the Pentium,PII,PIII,P4?

Does it include Celeron CPU?

And Does it include Amd CPU?

zhz <zhz_zhang26@sina.com> wrote:

“Bill Caroselli” <> qtps@earthlink.net
:c4rjor$i3i$> 1@inn.qnx.com> …
I believe that any Pentium class system will work fine with the RDTSC
instruction. I also believe that the docs are just being overly cautious
since this may not be safe on all CPU types, they just mark it as not
interrupt safe. That way they won’t have to explain why it didn’t work
when you port to another CPU.

I would go ahead and continue to use the ClockCycles() call. If it works
you’re fine. If it doesn’t, then I was wrong.



what does “any Pentium class system” mean?

Anything that implements the rdtsc op code. :slight_smile:

Does It only include the Pentium,PII,PIII,P4?

Does it include Celeron CPU?

And Does it include Amd CPU?

The reason it was specified as “Pentium class” was because the rdtsc
op code (to get a free-running 64-bit counter) did not exist for the
486 CPUs, but was first implemented (added to the “standard” x86
instruction set) with Intel’s Pentium CPUs.

I would expect that most Intel and AMD CPUs nowadays would implement
it, with the exception of old/low-power 486/386 compatible type
CPU cores.

-David

QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.