Currently wtperf plays tricks so that it can run multiple compacts (LSM) on different tables simultaneously. Since it already is essentially an asynchronous operation, all the API call does is set a flag to trigger the LSM merge threads to start merging, aggressively, it is a small step further to trigger the merge and just call a callback when it is done.
The trick wtperf plays is to use the minimum timeout of 1 second, ignoring the ETIMEDOUT error return, calling compact for each table. Then in a second loop, calls compact a second time with no timeout to wait for the compact to complete.
Currently the LSM compact code sleeps for 10 seconds minimum to get the operation started before and then the timeout value, for a total of 11 seconds per table before returning.