4

I could not set the interval between the generated events by monkey. The official documentation defines the usage of --throttle as "Inserts a fixed delay between events. You can use this option to slow down the Monkey. If not specified, there is no delay and the events are generated as rapidly as possible."

I need to generate 500 events with a 1-second interval between them.

Here is what I have used:

monkey -v --throttle 1000 -p com.estrongs.android.pop 500

So, the process should take at least 1000*500 milliseconds which mean more than 8 minutes. But the job finishes in seconds.

Is there something I miss? How do you set the interval between events generated by monkey tool?

talha06
  • 6,206
  • 21
  • 92
  • 147

1 Answers1

3

monkey injects the specified delay after a group of events. You can specify only one type of events and time the command and the result will be as expected.

time monkey -v -v -v --throttle 2000 --pct-touch 100 -p  com.estrongs.android.pop 50

this will print some messages like

...
Sleeping for 2000 milliseconds
:Sending Touch (ACTION_DOWN): 0:(669.0,1746.0)
:Sending Touch (ACTION_UP): 0:(658.455,1740.9874)
Sleeping for 2000 milliseconds
:Sending Touch (ACTION_DOWN): 0:(617.0,436.0)
:Sending Touch (ACTION_UP): 0:(616.7584,433.1081)
Sleeping for 2000 milliseconds
:Sending Touch (ACTION_DOWN): 0:(529.0,1399.0)
:Sending Touch (ACTION_UP): 0:(529.58325,1405.1238)
Sleeping for 2000 milliseconds
:Sending Touch (ACTION_DOWN): 0:(46.0,551.0)
:Sending Touch (ACTION_UP): 0:(52.594234,557.6963)
Sleeping for 2000 milliseconds
:Sending Touch (ACTION_DOWN): 0:(1004.0,1706.0)
Events injected: 50

and then time:

0m50.30s real     0m00.20s user     0m00.04s system

which indicates the approx 50 secs expected (50*2000/2), 2 because it sends DOWN & UP.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134