iOS Simulator: Test Cases run super slow on Simulator --- Toggle Slow Animations

Asked by Bob Hag on 2012-02-03

I am running Sikuli - 1.0 rc3 (r905)
Java Version is up to date Build 1.6.0
OS X Lion 10.7.3
I am running ios Simulator 5.0

What happens is when I am running Sikuli tests the iPhone application becomes very slow and slower and slower.
It's So slow that the transitions between pages are visible and look like they are in slow motion.

Any ideas as to what things I can check or if this is a known issue? or workarounds, etc.

Thanks for your help and support.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Bob Hag
Solved:
2012-02-15
Last query:
2012-02-15
Last reply:
2012-02-14
RaiMan (raimund-hocke) said : #1

Already checked in ActivityMonitor about memory consumption by the different processes?

This usually means, that there are some memory constraints.

Sikuli should not use more than about 300 MB of physical memory.

Start from scratch, open all applications needed and check memory for these processes. When things get slower, check again and find out, which of the processes increased its memory dramatically.

Bob Hag (bobhag) said : #2

I did check this and I still can't figure out why. The memory consumption isn't the issue. The memory didn't even spike above 300 and there were no other applications using excess memory.

Question 1: Have you guys been able to run Sikuli with OS X Lion 10.7.3, and I am running ios Simulator 5.0. Do any of the applications slow down? Is anyone else have this issue?

Any other suggestions?

Thanks for your time and help.

Bob Hag (bobhag) said : #3

Actually I found out that even though the Real Memory does not go above 300. The % CPU usage did go about 100%

Bob Hag (bobhag) said : #4

I switch iOS Simulator from 5 to 4.3.2 and they both have the same issue.

But, I think what's happening is for some reason: The it is toggling the iOS Simulator to Slow Animations.
What I did was manually click Debug menu for iOS Simulator and click (Toggle Slow Animations) and Sikuli tests started running fast again. However, for some reason it switches back to this.

Any ideas on why this is doing it?

Thanks

RaiMan (raimund-hocke) said : #5

--- The % CPU usage did go about 100%
What process exactly is taking this much cpu?

--- iOS Simulator to Slow Animations.
if you think it is this, I found this on the net:
You can toggle slow-motion animations on and off by pressing Shift three times in succession while the iOS Simulator is in focus.
or this one:
There’s a new way to slow down simulator which is really handy in case you want to debug rotation animations:
In the Hardware menu, enable “Simulate Hardware Keyboard”.
Hit the shift key three times in a row
Now all the animations are slowed down for debugging. Triple-hit Shift again to deactivate.

How this starts automagically: The net does not really know why, so do I ;-)

Bob Hag (bobhag) said : #6

The Sikuli IDE process sometimes goes for 100% CPU

RaiMan (raimund-hocke) said : #7

Yes, this is a known "feature".

In the standard, Sikuli will try max 3 search retries per second. But on most machines and with normally searching the whole screen, this leads to continues cpu usage.

If you think this leads to problems, you might reduce the search rate by adapting the scan rates appropriately:

http://sikuli.org/docx/globals.html#Settings.WaitScanRate

Another possibility is to use exists(img, 0) (comes back after one search in all cases) instead of find(img) where it is possible.

Bob Hag (bobhag) said : #8

I didn't have these issues when I wasn't running Lion OS on my Mac.
I am not trying to run in slow motion. Something makes Sikuli switch to Slow motion.
and Yes I did see the workaround and re-selecting (Toggle Slow Animations) or pressing Triple-hit Shift again to deactivates it and makes the automation go faster but, then it automatically switches again and makes the test cases fail.

However, the whole idea of automation is have it run by itself and without supervision and review what failed.

I believe that you need to do more investigations having Lion OS.

RaiMan (raimund-hocke) said : #9

--- Something makes Sikuli switch to Slow motion
Your "Slow Motion" issue in your automated iOS simulator has nothing to do with Sikuli. Since Sikuli only simulates mouse and keyboard actions, that otherwise have to be done manually and in no other way interacts with the GUI, this must have other reasons.
And looking into the net, I got the impression, that there are situations (some have known reasons, some have not) that the simulator switches into slow animation mode by itself.

--- the whole idea of automation is have it run by itself and without supervision and review what failed.
Yes that is the idea. But to let it come to reality, it needs an automation workflow, that is robust. And this is the responsibility of the workflow scripter. Sikuli has many features to do that. Just having a sequence of clicks and types normally is only sufficient for small things.
Example: I made a really robust and tricky workflow with parallel observes, that I use in my daily work (about 150 lines of code). It automates a web interface and runs fine on all of my different machines. Yesterday I wanted to show it at a friend's home, but it did not work because of his lousy slow internet connection. I had the waiting times in my script all set to 20 seconds, but that was not enough in this case. So I have to admit finally: my script is still not robust enough and this is my fault.

--- I believe that you need to do more investigations having Lion OS.
I my self use Lion in my daily work. I have no problems with Sikuli (or Lion at all). I know, that the developers use Macs themselves. I do not think, that there are any special things together with Lion, that have to be investigated specially.

Bob Hag (bobhag) said : #10

Thanks again for your support. I am also thinking that it's a bug in iOS Simulator or Lion.
Not really sure. But, I know something is tripping the (Toggle Slow Animations) or pressing Triple-hit Shift again to deactivates it. What I have also done is Run the Sikuli tests in Slow motion and during places that Transitions are slow I added a small wait time as current workaround.

Ben Lau (benjamin-a-lau) said : #11

I've been having the same problem... Unfortunately in my case increasing the wait times wasn't proving to be an effective solution since I'm trying to running about 50 sikuli scripts with between 40 and 100 actions...

I ran across this tool called slowmo (https://github.com/mschrag/slowmo) that was designed to enable the slow motion mode in some versions of the iPhone Simulator that didn't support slow motion. But what I discovered is that with a small modification you can completely DISABLE slow motion such that it will never enable (using either the menu in the simulator or via the triple shift short cut).

I thought this might be useful to others... so I'm posting it here.

in slowmo.m change:
- [[(id<SlowmoMonitorController>)[NSClassFromString(@"MonitorController") sharedInstance] monitorWindow] setAllowTripleShiftSlowMotion:YES];
+ [[(id<SlowmoMonitorController>)[NSClassFromString(@"MonitorController") sharedInstance] monitorWindow] setAllowTripleShiftSlowMotion:NO];

You need to make sure slow motion is already off before running the tool... otherwise you might have other problems... and the scripts for building it probably need some mods for building with Lion. (I'll probably fork the project and implement those changes later today).

Hope this helps someone.