Solved

TChessBrd sample progam consume 99% of CPU time

Posted on 2004-04-01
3
235 Views
Last Modified: 2010-04-16
I have downloaded a TChessBrd component from www.torry.net. After installation and running sample program I found that it uses 99% of CPU time. The question is:

     How and what methodologies should I use to check that what is the problem in this program or component?

I am running a program on WinXP SP1 and Delphi6 (all patch updated).

Thanks.
0
Comment
Question by:soapsiam
3 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10740355
Is it the CPU useusge at its max only when the Chessboard component is doing its search for next best move?

SHane
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 125 total points
ID: 10741070

No, its always pegged due to the way the component is written. (done some testing with it). A quick and dirty on this, without picking it apart

// The execution point of the thread
procedure TChessThread.Execute;
begin
    repeat
    begin
        Sleep(100); // <-- Add this to the original code
        if ((ComputerPlaysWhite^)and(WhiteToMove^))or
           ((ComputerPlaysBlack^)and(WhiteToMove^=FALSE)) then
        begin
 
------------
Regards,
Russell

0
 
LVL 1

Expert Comment

by:FeralCTO
ID: 10742692
rllibby is right. When the Execute method of a thread loops, you gotta have a call to Sleep in it, or it will eat up the CPU.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now