public static String getPrintableStopwatchData() { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("-------------------------------------------------------------------------------------------------------------------------\n"); for (Entry<String, NumbersForTask> task : Stopwatches.allNumbers().entrySet()) { sb.append("Task '"+task.getKey()+"' took "+task.getValue().getMilliseconds()+"ms ("+task.getValue().getNumberOfMeasurements()+" measurements).\n"); } sb.append("-------------------------------------------------------------------------------------------------------------------------\n"); return sb.toString(); }
public static String getPrintableStopwatchData() { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("-------------------------------------------------------------------------------------------------------------------------\n"); for (Entry<String, NumbersForTask> task : Stopwatches.allNumbers().entrySet()) { sb.append("Task '"+task.getKey()+"' took "+task.getValue().getMilliseconds()+"ms ("+task.getValue().getNumberOfMeasurements()+" measurements).\n"); } sb.append("-------------------------------------------------------------------------------------------------------------------------\n"); return sb.toString(); }
@Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } };
@Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } };