Class ElapsedTime
- java.lang.Object
-
- net.haesleinhuepf.clij.clearcl.util.ElapsedTime
-
public class ElapsedTime extends Object
Utility class to measure execution time of a block of code (closure-based)- Author:
- royer
-
-
Field Summary
Fields Modifier and Type Field Description static booleansStandardOutputThis flag can be set statically to enable/disable stdout logging of elapsed times.
-
Constructor Summary
Constructors Constructor Description ElapsedTime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublemeasure(boolean pActive, boolean pForceOutput, String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable.static doublemeasure(boolean pActive, String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable.static doublemeasure(String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable.static doublemeasureForceOutput(String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable.
-
-
-
Method Detail
-
measure
public static double measure(String pDescription, Runnable pRunnable)
Measures the elapsed time of a Runnable.- Parameters:
pDescription- description of the runnablepRunnable- runnable- Returns:
- elapsed time in milliseconds
-
measureForceOutput
public static double measureForceOutput(String pDescription, Runnable pRunnable)
Measures the elapsed time of a Runnable. This version forces the outputto standard out.- Parameters:
pDescription- description of the runnablepRunnable- runnable- Returns:
- elapsed time in milliseconds
-
measure
public static double measure(boolean pActive, String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable. An optional boolean flag can be used to switch of the timing.- Parameters:
pActive- true measure, false execute without measuringpDescription- description of the code (runnable)pRunnable- runnable- Returns:
- elapsed time in milliseconds
-
measure
public static double measure(boolean pActive, boolean pForceOutput, String pDescription, Runnable pRunnable)Measures the elapsed time of a Runnable. An optional boolean flag can be used to switch of the timing.- Parameters:
pActive- true measure, false execute without measuringpForceOutput- forces output to standard outpDescription- description of the code (runnable)pRunnable- runnable- Returns:
- elapsed time in milliseconds
-
-