private static Collection<Callable<Void>> wrapWithStatsCallables(Collection<Callable<Void>> callables,
AtomicInteger noEstimateCounter) {
int size = callables.size();
Collection<Callable<Void>> wrapped = new ArrayList<Callable<Void>>(size);
int count = 0;
RunningAverageAndStdDev timing = new FullRunningAverageAndStdDev();
for (Callable<Void> callable : callables) {
boolean logStats = count++ % 1000 == 0; // log every 100 or so iterations
wrapped.add(new StatsCallable(callable, logStats, timing, noEstimateCounter));
}
return wrapped;