| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| From: | "Rod Pemberton" <do_not_have AT sorry DOT bitbucket DOT cmm> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: application that retrieve the number of cpu cycle, junk 'cycle' after expression |
| Date: | Tue, 7 Mar 2006 19:25:33 -0500 |
| Organization: | Info Avenue Internet Services, LLC |
| Lines: | 51 |
| Message-ID: | <dul8a0$aicf$1@news3.infoave.net> |
| References: | <1141737752 DOT 454796 DOT 204020 AT v46g2000cwv DOT googlegroups DOT com> |
| NNTP-Posting-Host: | c-68-60-59-250.hsd1.mi.comcast.net |
| X-Trace: | news3.infoave.net 1141777536 346511 68.60.59.250 (8 Mar 2006 00:25:36 GMT) |
| X-Complaints-To: | abuse AT infoave DOT net |
| NNTP-Posting-Date: | Wed, 8 Mar 2006 00:25:36 +0000 (UTC) |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 6.00.2800.1437 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1441 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"mames" <matteomamei AT yahoo DOT it> wrote in message
news:1141737752 DOT 454796 DOT 204020 AT v46g2000cwv DOT googlegroups DOT com...
> hi to everyone is the first time i write but i looking for an assembler
>
> problem and i don't manage to find a solution. i've found on internet
> an application that retrieve the number of cpu cycle. it's wrote in
> assembler and i don't manage to use its.
>
> double GetMachineCycleCount()
> {
> double cycles;
> __asm("cpuid");
> __asm("rdtsc");
> __asm("mov %ebx,OFFSET cycles");
> __asm("mov ebx,%eax");
> __asm("mov ebx+4,%edx");
> return cycles;
> }
>
> when i compile the application (i'm using devc++) it notice me this
> error:
> error....junk 'cycle' after expression
>
> what is it mean?
> thanks a lot to everyone
(I didn't realize you were cross posted, so I'll post here too.)
I'm not familiar with devc++ (GCC based), but I am familiar with GAS(GCC)
and WASM. It appears that you are mixing GAS and MASM style intructions.
For GAS (and hopefully devc++), it'd look more like this:
unsigned long long GetMachineCycleCount()
{
unsigned long long cycles;
__asm__ __volatile__(
"cpuid\n"
"rdtsc\n"
:"=A"(cycles)
);
return cycles;
}
Notice that the returned type isn't 'double'.
Rod Pemberton
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |