Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: CPU Usage

Author: Sven Reichard

Date: 04:33:07 12/01/03

Go up one level in this thread


On November 30, 2003 at 19:35:35, macaroni wrote:

>how is it possible to find out how much of the cpu is being used by an engine,
>preferably from within the engine (so it can print it out), i'm using win98, and
>my compiler is c++, dev-cpp.
>thanks

I'm a convinced Linuxer, but I hope this hint works for you anyway. I assume you
want to determine the percentage of the CPU time your process consumes.

1) Measure the CPU time used by your engine; this works with std::clock() in
ctime.
2) Measure the wall clock time. Under Linux, this is done by gettimeofday();
however, I think this call is POSIX specific. However, there has to be a call in
the Win API that does that.
3) The quotient of both times gives the desired percentage.

Just my two bits,
Sven.



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.