Package com.landawn.abacus.util
Class Profiler
java.lang.Object
com.landawn.abacus.util.Profiler
A simple way to run load/performance test.
Caution: if the loop number is too big, it may take a lot of memory to save the test result and impact the test result.
So instead of running the performance with big loop number:
Caution: if the loop number is too big, it may take a lot of memory to save the test result and impact the test result.
So instead of running the performance with big loop number:
final int bigLoopNum = 1000_000; Profiler.run(threadNum, bigLoopNum, roundNum, "yourMethod", () -> yourMethod());
// reduce the 'bigLoopNum' by for-loop:Profiler.run(threadNum, bigLoopNum / 1000, roundNum, "yourMethod", () -> { for (int i = 0; i < 1000; i++) { yourMethod(); } });
- Since:
- 0.8
- Author:
- Haiyang Li
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The Class MultiLoopsStatistics. -
Method Summary
Modifier and TypeMethodDescriptionrun
(int threadNum, int loopNum, int roundNum, Throwables.Runnable<? extends Exception> command) run
(int threadNum, int loopNum, int roundNum, String label, Throwables.Runnable<? extends Exception> command) run
(int threadNum, long threadDelay, int loopNum, long loopDelay, int roundNum, String label, Throwables.Runnable<? extends Exception> command)
-
Method Details
-
run
public static Profiler.MultiLoopsStatistics run(int threadNum, int loopNum, int roundNum, Throwables.Runnable<? extends Exception> command) - Parameters:
threadNum
-loopNum
-roundNum
-command
-- Returns:
-
run
public static Profiler.MultiLoopsStatistics run(int threadNum, int loopNum, int roundNum, String label, Throwables.Runnable<? extends Exception> command) - Parameters:
threadNum
-loopNum
-roundNum
-label
-command
-- Returns:
-
run
public static Profiler.MultiLoopsStatistics run(int threadNum, long threadDelay, int loopNum, long loopDelay, int roundNum, String label, Throwables.Runnable<? extends Exception> command) - Parameters:
threadNum
-threadDelay
-loopNum
-loopDelay
-roundNum
-label
-command
-- Returns:
-