sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #05595
Re: [Question #165336]: Script runs with 100% CPU
Question #165336 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/165336
RaiMan posted a new comment:
I made some tests (Mac Lion, X-1.0rc3).
In the standard during search operations in the standard 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://sikuli.org/docx/globals.html#Settings.WaitScanRate
--- the test script:
setROI = selectRegion()
Settings.ObserveScanRate = 1
SCREEN.isFound = False
def handler(e):
print "in handler"
e.region.isFound = True
e.region.stopObserver()
onAppear("logo.png", handler)
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 the IDE "remembers" the Settings.ObserveScanRate (not reset to default on rerun). So if you are doing some evaluations in the IDE and want to reset Settings.ObserveScanRate, set it to a high value (e.g. 100). I will report a request bug.
*** 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.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.