From: guy@Auspex.COM (Guy Harris)
Subject: Re: Accessing Real Time Clock in workstations (HPs, Suns, Dec Alphas)
Date: 21 Jan 94 19:25:18 GMT [thread overview]
Message-ID: <19677@auspex-gw.auspex.com> (raw)
In-Reply-To: CJzL87.D96@cbnewsi.cb.att.com
>gettimeofday(2) only returns the operating system's idea of time. I think that
>he is looking for code fragments on how to read the Real Time Clock
>chip.
Hopefully, HP-UX's "gettimeofday()" code in the kernel reads the
high-resolution clock, given the suggestion to use "gettimeofday()" on
HP machines; SunOS's "gettimeofday()" code has done that since SunOS
4.1.
However, that usually involves a trip into the kernel, so the time you
get back may not be the time that you made the call. If so, and if
that's not acceptable, you would have to try to read the clock yourself.
>I
>don't have this info but, there is a header file, /usr/include/sun4/clock.h,
>that describes the layout of various chips used by Sun.
Or, at least, on machines with the "sun4" kernel architecture - the
machines with that kernel architecture, and with high-resolution clocks,
are the SPARCsystem 3xx and SPARCsystem 4xx machines. Check out "struct
counterregs".
All machines with "sun4c", "sun4m", "sun4e", and, I suspect, "sun4d"
kernel architectures have high-resolution clocks. On "sun4c" machines,
check out "/usr/include/sun4c/clock.h"; again, check out "counterregs".
On "sun4m" machines, check out "counterregs" in
"/usr/include/sun4m/counter.h".
All that's for SunOS 4.x. SunOS 5.x doesn't have the relevant header
files in any obvious place (and no 4.x release runs on "sun4d" machines).
>You probably need
>this header file and then you probably need to call either ioctl(2) or mmap(2)
>to read/write the chip, just guessing though.
No "ioctl" exists to let you read the chip; besides, it's a system call,
so you don't win over using "gettimeofday()".
It might be possible to "mmap()" the clock in; you'd have to know its
physical address and map that in, *probably* from "/dev/obio".
I can't speak for HP or DEC machines, although they don't necessarily
make it any easier to get at the high-resolution clocks from user mode
than Sun machines do - they might, though.
next prev parent reply other threads:[~1994-01-21 19:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-01-20 20:40 Accessing Real Time Clock in workstations (HPs, Suns, Dec Alphas) NeoSwami
1994-01-20 21:42 ` Paul Gootherts
1994-01-21 12:23 ` Kell S|nnichsen
1994-01-21 15:48 ` john.j.rushford..jr
1994-01-21 19:25 ` Guy Harris [this message]
1994-01-24 17:12 ` Benjamin Z. Goldsteen
1994-01-25 8:08 ` Bart Smaalders
1994-01-25 18:42 ` Bob Manchek
1994-01-26 0:57 ` Doug Siebert
1994-01-26 8:11 ` Casper H.S. Dik
1994-01-27 4:07 ` Greg Limes
1994-01-29 5:07 ` mark hahn
1994-01-21 16:59 ` Bart Smaalders
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox