Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: code question

Author: Dann Corbit

Date: 19:42:46 10/03/03

Go up one level in this thread


On October 03, 2003 at 21:39:09, Mike Siler wrote:

>Right now, to find out how much time has passed in a search, my program uses a
>function identical to "get_ms()" in TSCP. The function is just:
>
>int get_ms(){
>	struct timeb timebuffer;
>	ftime(&timebuffer);
>	return (timebuffer.time * 1000) + timebuffer.millitm;
>}
>
>I discovered that this fairly slow function seems to be a big bottleneck in my
>program. I'm just wondering what other (C) programs use to get the time more
>quickly.

You can call the high resolution timer, or the CPU's timing instructions via
assembly.

You might also have a thread sleep for the allotted time and signal when it
wakes up.

But the real problem is that you are calling this function too often.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.