/** * Call @a runnable.run() and time how long it takes to run. */ public static void timeRun(Runnable runnable, String testName) { startTiming(); runnable.run(); stopTiming(); // Store the execution times into the results map. mResultsMap.put(testName, mExecutionTime); }
/** * Call @a supplier.get() and time how long it takes to run. * * @return The result returned by @a supplier.get() */ public static <U> U timeRun(Supplier<U> supplier, String testName) { startTiming(); U result = supplier.get(); stopTiming(); // Store the execution times into the results map. mResultsMap.put(testName, mExecutionTime); return result; }