This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Timers and less (fwd)


The following code works well if you are using a pentium, ppro, or pII; it
is an interface to the on-chip cycle counter:

	.file	"timer86a.s"
	.text
        .align    16
	.globl	_iclock
_iclock:
	.byte	0x0f, 0x31
        ret

In C, declare iclock as a long long int, it returns a 64-bit
integer that has resolution equal to the clock rate of the
chip.  The return value is in %eax, %edx (low, high) which
matches the C calling convention.

If you want time as a double you just divide the return
value by the clock frequency:

	extern long long iclock()
	time = iclock() / 200.0e6;

I guess you can use inline assembler in gcc, I haven't tried.

----- Forwarded message from Mark Koi -----

>From gnu-win32-owner@cygnus.com  Fri Aug 15 05:22:20 1997
Message-ID: <UnwpQpFz000140iExo@stoneaxe>
Date: Thu, 14 Aug 1997 14:06:29 -0500 (EST)
From: Mark Koi <koi@ssa.crane.navy.mil>
To: gnu-win32@cygnus.com
Subject: Timers and less
Sender: owner-gnu-win32@cygnus.com
Precedence: bulk

I just installed the binaries.  I was using
DJGPP before with ALLEGRO for timers.  Those
allegro library calls don't work, and can't
seem to compile allegro with gnu-win32.  

DOES SOMEBODY HAVE A SIMPLE TIMER PROGRAM?
NEED RESOLUTION OF 100ms, not a big request
but a little lost.

Also, can somebody mail me a uuencoded copy
of less.exe for gnu-win32.  Or is it just
as easy to get source and compile.  

koi@ssa.crane.navy.mil
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

----- End of forwarded message from Mark Koi -----
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]