Sikuli uses 100% cpu with wait(image) and observe()
- Keywords:
- Last updated by:
- RaiMan
This is based on Sikuli X 1.0rc3.
In the standard during search operations Sikuli is searching for the visual object continuously. This leads to 100% cpu, since this process is just looping continuously through byte arrays.
This is ok, for find operations, since you expect them to be finished as fast as possible.
If this is a problem for you during a longer wait or observe, feel free to reduce the scan rate to once per second or even less often. This reduces the cpu usage. E.g. searching once every 2 seconds might be acceptable, if you expect something to appear within the next 60 seconds.
look: http://
--- the test script:
setROI = selectRegion()
Settings.
SCREEN.isFound = False
def handler(e):
print "in handler"
e.region.
e.region.
onAppear(
observe(FOREVER, True) # runs in background
while not SCREEN.isFound:
print "waiting"
wait(5)
print "finished"
"logo.png" was the Sikuli logo in a browser window, that I could hide and reveal by scrolling.
*** Caution:
Currently (rc3) the IDE "remembers" the Settings.
*** BTW:
I never had any problems with this behavior of Sikuli, neither on Mac nor on Windows - at least with the foreground apps and their responsiveness.