Created
June 14, 2016 13:32
-
-
Save eruvanos/f23bf6c622b9b83f188429858507bf9f to your computer and use it in GitHub Desktop.
StopWatchHolder: Holds Spring Stopwatch as static field and extends a next() method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.siemering.gist; | |
import org.springframework.util.StopWatch; | |
public class SwHolder{ | |
private static StopWatch sw = new StopWatch(); | |
public static void start(String taskName) throws IllegalStateException { | |
sw.start(taskName); | |
} | |
public static void next(String taskName) throws IllegalStateException { | |
sw.stop(); | |
sw.start(taskName); | |
} | |
public static void stop() throws IllegalStateException { | |
sw.stop(); | |
} | |
public static double getTotalTimeSeconds() { | |
return sw.getTotalTimeSeconds(); | |
} | |
public static long getTotalTimeMillis() { | |
return sw.getTotalTimeMillis(); | |
} | |
public static String shortSummary() { | |
return sw.shortSummary(); | |
} | |
public static String prettyPrint() { | |
return sw.prettyPrint(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment