From: David Jenkins Newsgroups: comp.os.msdos.djgpp Subject: Re: Measuring frame rate more often Date: Wed, 23 Apr 1997 14:53:36 +0100 Organization: None Distribution: world Message-ID: References: <335DADA6 DOT 41A0 AT canvaslink DOT com> NNTP-Posting-Host: jenkinsdavid.demon.co.uk MIME-Version: 1.0 Lines: 48 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <335DADA6 DOT 41A0 AT canvaslink DOT com>, Tom Grandgent writes >I need some way to accurately measure the number of frames per second >(or milliseconds per frame or something?) more often than once per >second. If anyone knows how I might be able to do this, I would be >very appreciative. > >BTW, the formula I am using to calculate the corrected player speed is: >effective_speed = logical_speed * (1 / fps / TARGET_FPS); This is a pseudo c source showing how I measure the time for each frame. #include main(){ char txt[50]; int frame_time; Your other stuff here before the main loop. for (d=0 ; d<1000 ; d++){ frame_time = uclock(); /* Some out of this world functions moving your sprites and drawing your Quake beating 3D world go here. */ sprintf(txt ,"Time = %d" ,uclock()-frame_time); textout(buffer ,font ,txt ,0,0,1); /* Or some other method of printing "txt" to the screen */ } } I think the uclock() is accurate to 10,000 ticks per second. -- http://www.jenkinsdavid.demon.co.uk for Newbie C programmers and a larf. ;-) David Jenkins