Add ability to wait for counters and use to optimize tests.