I have a kernel program that uses clock_gettime(). The clock
resolution is too low at the default (sysClkRateGet() = 60), so I
would like to increase it to 120 or so with sysClkRateSet() and
clock_setres(). What are the ramifications of doing this? What might
be the impact to other tasks running? Is it common to change the
software clock this way? Is there a better way (another timer?) to get
better resolution?
VxWorks 6.5 on PPC604.
TIA
What I said, in essence, was:
- clock_setres() is a noop routine: it always return OK and does
nothing.
- changing the system clock rate will affect all tasks that called
routines with timeout, alarm(), nanosleep(), timer_gettime(), etc.
before the clock rate changed. I believe should not affect tasks that
called those routines after the clock rate was changed.
- if you use POSIX routines there is not much else you can do on
VxWorks to get a higher clock resolution. Otherwise you can use the
high resolution timestamp driver (sysTimestamp()) if one is available
on your board.
Hope this helps,
--
PAD
This is good. Thanks. I'm rather new to using this timer stuff as you
may be able to tell.
sysTimeStamp() does seem to have the resolution I'm seeking. The timer
runs at 50Mhz so, it rolls over at about 85-86 secs. How can I trap
this roll over? Can I connect it to my own ISR? Is it in use by the OS
(so there's already an ISR connected)? What I'm trying to do is create
a task that can call my time function as a stopwatch. So the first
call starts a timer (just stores a timestamp) and a second call stops
the timer (returns the time elapsed). Can I read some registers? I've
read some stuff and about a TBU/TBL register pair but don't know how
to access them in code.
VxWorks 6.5 on CW VPX6-185, Freescale 8641 CPU
TIA
Use sysTimestampConnect() to attach your ISR to the high resolution
timer interrupt. I don't think it is used by any of the OS sub-systems
since the high resolution timer device is not available on all boards.
It may be used by optional monitoring features though; for instance I
know that the System Viewer makes ut of it if available.
I don't think that anything would prevent your ISR to read register
content but I don't know how to get to the TBU and TBL registers if
their content is not provided in the REG_SET structure. May be this
does not matter but note that if your ISR calls the taskRegsGet() API
it will provide the content of the register set for the task that got
interrupted by the ISR.
Cheers,
--
PAD
Use sysTimestampConnect() to connect your own ISR to the timestamp
timer interrupt. I don't think any of the OS sub-systems use the high
resolution timer since it is not available on all boards. Some
optional monitoring features may use it though; I know the System
Viewer does.
I don't think there is anything that would prevent your ISR to read
register content but I can't help regarding the TBU/TBL registers if
they are not part of the REG_SET structure. I don't know whether this
matters but note also that the register content you'll get via
taskRegsGet() will be that of the task that got interrupted by your
ISR.
Cheers,
--
PAD