← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #262157]: What is the best way to check CPU load?

 

Question #262157 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/262157

    Status: Open => Answered

RaiMan proposed the following answer:
The basic concept of SikuliX is to wait on a given image to appear on the screen.
The standard waiting time is 3 seconds, that can be extended either globally, per region or per function.
During this given waiting time SikuliX periodically takes a screenshot (whole screen or given region), to search for the given image in this shot-image.
This is repeated until either the image appeared or the waiting time limit is reached.

The search of the given image in the actual screenshot-image  is our number crunching and for some 10 to some 100 milliseconds creates a very high cpu load.
On weak machines and always searching the whole screen (instead of customized restricted smaller region) this may lead to a constantly high cpu load, that might have an impact on other processes demanding much cpu too.
In this case, in a first step one should try to minimize the searches (some click locations might be evaluated as relative to matches already found before) and make the search regions as small as possible.
If this is not enough, than one might lower the scan rate (the rate at which SikuliX agin looks for the given image on the screen) either gnerally or in critical parts of the workflow.

In the standard the scan rate is 3, meaning, that only after 1/3 of a
second after the previous search started, a new search is started. As
mentioned already: on weak machines, with large screens and always
searching the whole screen this may lead to a "always searching"
situation with high cpu load. A search on a weak machine on the whole
screen on average may take more than 500 millisecs.

So if you think, you have this problem and are using optimized workflows, you might adjust the scan rate:
http://sikulix-2014.readthedocs.org/en/latest/scripting.html#Settings.WaitScanRate

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.