www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/30/10:58:07

Message-Id: <1.5.4.32.19970430143433.002ef264@ubeclu.unibe.ch>
Mime-Version: 1.0
Date: Wed, 30 Apr 1997 16:34:33 +0200
To: cwine AT sarnoff DOT com
From: Roger Noss <noss AT pupk DOT unibe DOT ch>
Subject: Re: NT programs How? Thanks.
Cc: djgpp AT delorie DOT com

At 11:05 AM 4/28/97 -0400, cwine AT sarnoff DOT com wrote about how to create programs
that ran efficiently under NT.  Following the advice of Joshua Heyer, he
tried and recommended rsxntdj for creating win32 programs:
>
>My dummy benchmark, that completed about 500 calls to time(),
>when compiled with vanilla DJGPP gcc, completes over 100,000,
>when compiled as a win32 program.
>
>My real benchmark, that also did about 500 calls, now completes
>about 10,000 units of think. (A reasonable value).

Well, I'm all in favor of 10x speedups, so I tried rsxntdj too.  I did the
4-step in the rsxntdj .hlp file concerning the path and environment
variables.  Then I recompiled a simple working program using

        gcc -Zwin32 tstvsync.c

and got some #include conflicts from time.h and go32.h:

Here is the compiler output:

In file included from tstvsync.c:6:
c:/cpp/djgpp/rsxntdj/include/time.h:12: warning: redefinition of `size_t'
c:/cpp/djgpp/include/go32.h:17: warning: `size_t' previously declared here
tstvsync.c: In function `main':
tstvsync.c:16: `uclock_t' undeclared (first use this function)
tstvsync.c:16: (Each undeclared identifier is reported only once
tstvsync.c:16: for each function it appears in.)
tstvsync.c:16: parse error before `t0'
tstvsync.c:25: `t0' undeclared (first use this function)
tstvsync.c:33: `t1' undeclared (first use this function)
tstvsync.c:35: `UCLOCKS_PER_SEC' undeclared (first use this function)

I replaced the rsxnt time.h with the djgpp one and got similar errors.
Now I'm stuck.
The program follows.  I realize there are extra header files included, but
eventually I will have to have them for my graphical application so I left
them in.  Or does rsx include its own version of them?  I don't think I'm
grasping the concept of rsx yet.

/* tstvsync.c */

#include <dpmi.h>
#include <sys/farptr.h>
#include <go32.h>	/* for the declaration of _dos_ds */
#include <time.h>
#include <pc.h>
#include <conio.h>
#include <stdlib.h>
#include <math.h>				/* for rand() */

int main(void)
{
	int i, j;
	int flyback, scanning;
	uclock_t t0, t1;

	/*************************/
	/* test vertical retrace */
	/*************************/

	printf( "\n testing vertical retrace ... \n" );

	while ( ! ( 8 & inportb( 0x3da ) ) );	/* wait for vsync */
	t0 = uclock();				/* start timer    */
	flyback = 0;
	scanning = 0;
	for (i=0; i < 100; i++ )		/* collect 100 frames */
	{
                while ( ( 8 & inportb( 0x3da ) ) ) flyback++;	
		while ( ! ( 8 & inportb( 0x3da ) ) ) scanning++;
	}
	t1 = uclock();

	printf( "100 frames took %d ms\n",
                (int) (t1-t0) * 1000 / UCLOCKS_PER_SEC );
	printf( "flyback = %d, scanning = %d, ratio = %f\n",
		flyback, scanning, 1.* flyback / scanning );
	return 0;
}

- Raw text -


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