/** * */ package at.gv.egiz.pdfas.performance; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * @author wprinz * */ public class PerformanceTimer { /** * The log. */ private static Log log = LogFactory.getLog(PerformanceTimer.class); protected String name = null; protected long startTime = -1; protected long stopTime = -1; public PerformanceTimer(String name) { this.name = name; } public void start() { this.startTime = System.currentTimeMillis(); log.trace(this.name + ": started at " + this.startTime); } public void stop() { this.stopTime = System.currentTimeMillis(); log.trace(this.name + ": stopped at " + this.stopTime); log.trace(this.name + ": time elapsed = " + getTimeElapsed()); } public long getTimeElapsed() { return this.stopTime - this.startTime; } }