SYSPAGE_ENTRY(qtime)->cycles_per_sec Problem

I am running QNX 6.1 on a X86 machine. I measure a time difference between
to interrupts using ClockCycles().

I measure the same time difference with a high quality 1ns resolution GPS
which I assume is precise enough for my application.

However, when I compute the time difference using the clockcycles and divide
the difference by SYSPAGE_ENTRY(qtime)->cycles_per_sec I have a difference
of about 1ms against the GPS;

Recomputing the processor speed with the GPS time difference yields in a
difference of about 340kHz on a 860MHz PIII versus the
SYSPAGE_ENTRY(qtime)->cycles_per_sec value.

How can I obtain a more precise value for the processor cycles.

Thanks,

Marcus

Hi Marcus…

news.fernuni-hagen.de wrote:
<…>

How can I obtain a more precise value for the processor cycles.

generate an output signal at each interrupt (i.e. digital line), and
then use an oscilloscope to measure what you want…

regards…

Miguel.


Thanks,

Marcus

It might help to consider where SYSPAGE_ENTRY(qtime)->cycles_per_sec
comes from. I believe it is calculated on the basis of two rdtsc
readings taken 10 ms apart, with the 10 ms being measured by observing
the 8254 counter. Even ignoring resolution, the accuracy of
SYSPAGE_ENTRY(qtime)->cycles_per_sec will be limited by the accuracy of
the crystal controlling your 8254; you’re seeing discrepancies of less
than 500 parts per million, and that doesn’t sound unreasonable. If you
have a more accurate way to measure the time between a couple of
rdtsc’s, then you can certainly calculate a more accurate value for the
processor cycles.

Murf

news.fernuni-hagen.de” wrote:

I am running QNX 6.1 on a X86 machine. I measure a time difference between
to interrupts using ClockCycles().

I measure the same time difference with a high quality 1ns resolution GPS
which I assume is precise enough for my application.

However, when I compute the time difference using the clockcycles and divide
the difference by SYSPAGE_ENTRY(qtime)->cycles_per_sec I have a difference
of about 1ms against the GPS;

Recomputing the processor speed with the GPS time difference yields in a
difference of about 340kHz on a 860MHz PIII versus the
SYSPAGE_ENTRY(qtime)->cycles_per_sec value.

How can I obtain a more precise value for the processor cycles.

Thanks,

Marcus

I’m not going to claim to be an expert on this problem or situation and
I’m not sure if what I’m going to post helps out, but a coworker and I
recently wrote an ISR routine (in QNX 4) to access the Real Time Clock
chip and have it produce an interrupt every ~488 micro seconds, (2048Hz
I think). I don’t know how reliable this clock tick is (I haven’t used
it other than to do some preliminary testing, no o-scope testing yet).
I could post the QNX 4 code for someone, I haven’t ported it to 6 yet
but I will be doing that sometime in the future.


C. Scott Anderson


news.fernuni-hagen.de wrote:

I am running QNX 6.1 on a X86 machine. I measure a time difference between
to interrupts using ClockCycles().

I measure the same time difference with a high quality 1ns resolution GPS
which I assume is precise enough for my application.

However, when I compute the time difference using the clockcycles and divide
the difference by SYSPAGE_ENTRY(qtime)->cycles_per_sec I have a difference
of about 1ms against the GPS;

Recomputing the processor speed with the GPS time difference yields in a
difference of about 340kHz on a 860MHz PIII versus the
SYSPAGE_ENTRY(qtime)->cycles_per_sec value.

How can I obtain a more precise value for the processor cycles.

Thanks,

Marcus
\

In article <3F44E29A.4040601@nospam.com>, c.scott@nospam.com says…

I’m not going to claim to be an expert on this problem or situation and
I’m not sure if what I’m going to post helps out, but a coworker and I
recently wrote an ISR routine (in QNX 4) to access the Real Time Clock
chip and have it produce an interrupt every ~488 micro seconds, (2048Hz
I think). I don’t know how reliable this clock tick is (I haven’t used
it other than to do some preliminary testing, no o-scope testing yet).
I could post the QNX 4 code for someone, I haven’t ported it to 6 yet
but I will be doing that sometime in the future.

Hi,

Seems I really have to translate my article to English :slight_smile: I just checked the result of the on-line
translator:

http://www.translate.ru/url/tran_url.asp?lang=ru&url=http%3A%2F%2Fed1k.qnx.org.ru%2Frtc.html&directi
on=re&template=General&cp1=NO&cp2=NO&autotranslate=off&transliterate=on

it’s terrible :slight_smile:

Well, that article is about utilization RTC chip on x86 under QNX6. You can download tarball and I
hope you will have good exapmle for your project.

ftp://ftp.qnx.org.ru/pub/projects/ed1k/clock.tgz

That clock tick is reliable as everything else in PC. It’s just quartz precission oscillator and its
frequency could be divided to get 2**x frequency series: 2Hz, 4Hz… 8192Hz.

Cheers,
Eduard


C. Scott Anderson