High Cpu load by starting and stopping observer in while()

Asked by Jerry Arya A

Greetings, I'm Jerry. I'm using sikulix ide 2.0.5 to create a bot for a browser game for myself, and currently I have a problem with cpu load. Here's some details.

I'm using 10 onAppear for 1 observer on 1 region. After defining the onAppear first at start, I use while(1) then start and stopping the observer in it.
At first run, the cpu load only around 10-11%, but after about 10 repetitions, the cpu got high load around 75-80%. After I check, for 1 repetition, the cpu load increases around 5-10%, and keep going up.

Here's a snippet on the script :

DefineOberver() #onAppear declaration goes here

While(1)
   MyRegion.observeInBackground()
   Raid()
   MyRegion.stopObserver()

Any idea why this can happen, and how to solve this? I can put more of my codes here if it helps.

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

runtime script from command line:

java -jar <sikulix.... jar> -c -r <your script>

and put
Debug.on(3)

at the top of the main script.

Might be that the debug output reveals something of interest.

you can send me your code to my mail sikulix---at---outlook---dot---com.

I would have a look at it the next days.

Revision history for this message
Jerry Arya A (vegasphinx) said :
#2

I've sent the stripped down code for easier reading, and I've tested it, and the result is still the same, increasing cpu load on every repetitions.

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.