* How to find out clock frequency under DU ?
@ 1997-03-17 5:00 A.Arnold
1997-03-24 5:00 ` Burkhard Neidecker-Lutz
0 siblings, 1 reply; 2+ messages in thread
From: A.Arnold @ 1997-03-17 5:00 UTC (permalink / raw)
On an AlphaStation running Digital Unix, is there a way for a C program to find
out the processor's clock speed? I am using the processor's cycle counter to
get a high-resolution, low-overhead timer, and I want to make my code machine-
independent (i.e. the scaling factor should adapt to the processor's clock).
I tried delaying for a known time with usleep() a measuring the difference in
clocks, but that doesn't seem to be very accurate...
--
--------------------------------------------------------------------------------
Alfred Arnold Phone: +49 (2461) 61-2434
Zentralinstitut fuer Angewandte Mathematik Fax : +49 (2461) 61-6656
Forschungszentrum Juelich E-Mail: a.arnold@kfa-juelich.de
D-52425 Juelich, Germany
--------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to find out clock frequency under DU ?
1997-03-17 5:00 How to find out clock frequency under DU ? A.Arnold
@ 1997-03-24 5:00 ` Burkhard Neidecker-Lutz
0 siblings, 0 replies; 2+ messages in thread
From: Burkhard Neidecker-Lutz @ 1997-03-24 5:00 UTC (permalink / raw)
In article <5gj3cd$idk@zam201.zam.kfa-juelich.de> a.arnold@kfa-juelich.de writes:
>
>On an AlphaStation running Digital Unix, is there a way for a C program to find
>out the processor's clock speed?
#include <c_asm.h>
main()
{
unsigned int start, finish, count = 0;
start = asm("rpcc %v0");
count -= start;
sleep(1);
finish = asm("rpcc %v0");
count += finish + 500000;
count /= 1000000;
printf("CPU is %d Mhz\n", (int) count);
}
Burkhard Neidecker-Lutz
CEC Karlsruhe , European Applied Research Center, Digital Equip. Corp.
email: neideck@kar.dec.com
433Mhz 21164, 64 MB RAM, 2.1 GB SCSI, SPEC95 12.6e/12.0e, Linux preinstalled
Just $4630,, See http://www.swt.com/alpha_linux.html for details
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-03-24 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-03-17 5:00 How to find out clock frequency under DU ? A.Arnold
1997-03-24 5:00 ` Burkhard Neidecker-Lutz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox