| www.delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| Message-ID: | <3C0B7D51.F096A01A@yahoo.com> |
| From: | CBFalconer <cbfalconer AT yahoo DOT com> |
| Organization: | Ched Research |
| X-Mailer: | Mozilla 4.75 [en] (Win98; U) |
| X-Accept-Language: | en |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: RDTSC ? |
| References: | <Pine DOT A41 DOT 4 DOT 05 DOT 10112030837410 DOT 57664-100000 AT ieva06> |
| Lines: | 29 |
| Date: | Mon, 03 Dec 2001 14:32:53 GMT |
| NNTP-Posting-Host: | 12.90.174.157 |
| X-Complaints-To: | abuse AT worldnet DOT att DOT net |
| X-Trace: | bgtnsc04-news.ops.worldnet.att.net 1007389973 12.90.174.157 (Mon, 03 Dec 2001 14:32:53 GMT) |
| NNTP-Posting-Date: | Mon, 03 Dec 2001 14:32:53 GMT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Andris Pavenis wrote:
>
> On Sun, 2 Dec 2001, Damien Knight wrote:
>
> > As I've been told, RDTSC is a feature of pentium (and up) processers that
> > tracks the number of processer cycles completed since the system last
> > powered up, making it useful for calculating system uptime - but more
> > importantly, it can be used to test code optimization and so on.
> >
> > My question : How do I get this value and use in in a DJGPP program? If
> > anyone has a function already written, that'd be great.
>
> inline long long rdtsc (void)
> {
> long long result;
> asm volatile ("rdtsc" : "=A"(result));
> return result;
> }
And if you call this function on a 486 you get a crash. So guard
it by checking the actual CPU first.
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
(Remove "XXXX" from reply address. yahoo works unmodified)
mailto:uce AT ftc DOT gov (for spambots to harvest)
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |