delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/01/16/14:15:43

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Cristiano" <cristiano DOT pi AT NSquipo DOT it>
Newsgroups: comp.os.msdos.djgpp
Subject: Reading the TSC
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
NNTP-Posting-Host: $$_ewfrlexhg4.x-privat.org
Message-ID: <43cbed4a_1@x-privat.org>
Organization: X-Privat NNTP Server - http://www.x-privat.org
X-Authenticated-User: $$g656buj-7nk5btgknyi-m
X-Complaints-To: abuse AT x-privat DOT org
Date: 16 Jan 2006 20:00:26 +0100
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to write the Pentium time-stamp counter in a file under MSDOS.
DJGPP says that there is a parsing error. Please, could somebody help me?

#include <stdio.h>

#define RDTSC (llptr) ({ \
__asm__ __volatile__ ( \
        ".byte 0xff; .byte 0x31" \
        : "=A" (llptr) \
        : : "eax" , "edx"); })

int main(void)
{
  FILE *f = fopen("RDTSC.txt", "wb");
  unsigned long tsc[2], *llptr=tsc;

  RDTSC(llptr);

  fprintf(f,"%u",tsc[0]); fclose(f); return 0;
}

Can I use "unsigned long long tsc" instead of "unsigned long tsc[2]"?

Thanks
Cristiano 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019