public class PerfTestUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PerfTestUtils.RunTest
Utility class for storing a test label.
|
Modifier and Type | Field and Description |
---|---|
static double |
NANO_TO_MILLI
Nanoseconds to milliseconds conversion factor (1.0E-6).
|
Constructor and Description |
---|
PerfTestUtils() |
Modifier and Type | Method and Description |
---|---|
static StatisticalSummary[] |
time(int repeatChunk,
int repeatStat,
boolean runGC,
Callable<Double>... methods)
Timing.
|
static StatisticalSummary[] |
timeAndReport(String title,
int maxNameWidth,
int repeatChunk,
int repeatStat,
boolean runGC,
PerfTestUtils.RunTest... methods)
Timing and report (to standard output) the average time and standard
deviation of a single call.
|
static StatisticalSummary[] |
timeAndReport(String title,
PerfTestUtils.RunTest... methods)
Timing and report (to standard output).
|
static double[][][] |
timesAndResults(int repeatChunk,
int repeatStat,
boolean runGC,
Callable<Double>... methods)
Timing.
|
public static final double NANO_TO_MILLI
@SafeVarargs public static StatisticalSummary[] time(int repeatChunk, int repeatStat, boolean runGC, Callable<Double>... methods)
repeatChunk
- Each timing measurement will done done for that
number of repeats of the code.repeatStat
- Timing will be averaged over that number of runs.runGC
- Call System.gc()
between each timed block. When
set to true
, the test will run much slower.methods
- Codes being timed.methods
, a
StatisticalSummary
of the average times (in milliseconds)
taken by a single call to the call
method (i.e. the time
taken by each timed block divided by repeatChunk
).@SafeVarargs public static double[][][] timesAndResults(int repeatChunk, int repeatStat, boolean runGC, Callable<Double>... methods)
repeatChunk
- Each timing measurement will done done for that
number of repeats of the code.repeatStat
- Timing will be averaged over that number of runs.runGC
- Call System.gc()
between each timed block. When
set to true
, the test will run much slower.methods
- Codes being timed.methods
(first dimension), and
each of the repeatStat
runs (second dimension):
call
method (i.e. the time taken by each timed block divided
by repeatChunk
)
call
method.
public static StatisticalSummary[] timeAndReport(String title, int maxNameWidth, int repeatChunk, int repeatStat, boolean runGC, PerfTestUtils.RunTest... methods)
time
method.title
- Title of the test (for the report).maxNameWidth
- Maximum width of the first column of the report.repeatChunk
- Each timing measurement will done done for that
number of repeats of the code.repeatStat
- Timing will be averaged over that number of runs.runGC
- Call System.gc()
between each timed block. When
set to true
, the test will run much slower.methods
- Codes being timed.methods
, a statistics of the
average times (in milliseconds) taken by a single call to the
call
method (i.e. the time taken by each timed block divided
by repeatChunk
).public static StatisticalSummary[] timeAndReport(String title, PerfTestUtils.RunTest... methods)
timeAndReport(title, 45, 1000, 10000, false, methods)
.title
- Title of the test (for the report).methods
- Codes being timed.methods
, a statistics of the
average times (in milliseconds) taken by a single call to the
call
method (i.e. the time taken by each timed block divided
by repeatChunk
).Copyright © 2016 Hipparchus.org. All rights reserved.