Message-ID: <3B5E055C.388EDB30@cyberoptics.com> From: Eric Rudd Organization: CyberOptics X-Mailer: Mozilla 4.72 [en] (Win95; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Cpu speed detection using DJGPP? References: <458df9bf DOT 0107231326 DOT 14df82e1 AT posting DOT google DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 22 Date: Tue, 24 Jul 2001 18:31:40 -0500 NNTP-Posting-Host: 38.196.93.9 X-Trace: client 996017503 38.196.93.9 (Tue, 24 Jul 2001 19:31:43 EDT) NNTP-Posting-Date: Tue, 24 Jul 2001 19:31:43 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Daniel Friberg wrote: > How do I go about doing this? I am in the process of getting an IP release from my company for some code to do just that. When that happens, I'll post the code somehow. To satisfy your curiosity in the meantime, you measure the time elapsed between two successive increments of the rawclock() function, using the rdtsc instruction to get a timing in processor clocks, and multiply the rdtsc timing by the rawclock() frequency, which is nominally 13.125E6/(65536.*11.) Hz. If you are willing to time many rawclock() increments, you can get the processor clock rate accurate to a small fraction of a percent. On non-Intel processors that lack the rdtsc instruction, you have to use tricks like measuring the timing of a div instruction for various arguments. That's much less accurate. -Eric Rudd rudd AT cyberoptics DOT com