long "Waiting for Idle" in wptagent

I’m using wptagent on Linux (excellent work!).

When I look at wptagent stdout/stderr output, it sometimes waits quite long (20-30 secs) in “Waiting for Idle…”, on an otherwise idle server.

How exactly is it determined?

It waits for the CPU to go EXTREMELY idle. Specifically, no single core using more than 20% for at least 500ms. If there are other tasks running it could easily cause it to wait for the full time. On a 4 core system with HT that means overall CPU under 2.5%.

There are 2 different places where it will wait for idle. At startup it will wait for up to 10 minutes, basically to let the OS finish starting up and initializing things before starting to poll for work.

After launching the browser it will wait up to 30 seconds for idle to let the browser finish doing all of it’s startup initialization before running the test.

If you run top during the time when it is waiting for idle you should be able to get an idea for what process is causing it to delay. If it’s the browser itself then it may be related to slow storage (i.e. hard drive vs ssd) as it initializes caches, etc.