mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-10 06:55:32 +00:00
[TEST] Add additional assert logging
This commit is contained in:
parent
c71ae3519f
commit
82a369737b
@ -91,19 +91,19 @@ public final class QueueResizingEsThreadPoolExecutor extends EsThreadPoolExecuto
|
|||||||
* Calculate task rate (λ), for a fixed number of tasks and time it took those tasks to be measured
|
* Calculate task rate (λ), for a fixed number of tasks and time it took those tasks to be measured
|
||||||
*
|
*
|
||||||
* @param totalNumberOfTasks total number of tasks that were measured
|
* @param totalNumberOfTasks total number of tasks that were measured
|
||||||
* @param totalFrameFrameNanos nanoseconds during which the tasks were received
|
* @param totalFrameTaskNanos nanoseconds during which the tasks were received
|
||||||
* @return the rate of tasks in the system
|
* @return the rate of tasks in the system
|
||||||
*/
|
*/
|
||||||
static double calculateLambda(final int totalNumberOfTasks, final long totalFrameFrameNanos) {
|
static double calculateLambda(final int totalNumberOfTasks, final long totalFrameTaskNanos) {
|
||||||
assert totalFrameFrameNanos > 0 : "cannot calculate for instantaneous tasks";
|
assert totalFrameTaskNanos > 0 : "cannot calculate for instantaneous tasks, got: " + totalFrameTaskNanos;
|
||||||
assert totalNumberOfTasks > 0 : "cannot calculate for no tasks";
|
assert totalNumberOfTasks > 0 : "cannot calculate for no tasks, got: " + totalNumberOfTasks;
|
||||||
// There is no set execution time, instead we adjust the time window based on the
|
// There is no set execution time, instead we adjust the time window based on the
|
||||||
// number of completed tasks, so there is no background thread required to update the
|
// number of completed tasks, so there is no background thread required to update the
|
||||||
// queue size at a regular interval. This means we need to calculate our λ by the
|
// queue size at a regular interval. This means we need to calculate our λ by the
|
||||||
// total runtime, rather than a fixed interval.
|
// total runtime, rather than a fixed interval.
|
||||||
|
|
||||||
// λ = total tasks divided by measurement time
|
// λ = total tasks divided by measurement time
|
||||||
return (double) totalNumberOfTasks / totalFrameFrameNanos;
|
return (double) totalNumberOfTasks / totalFrameTaskNanos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -192,7 +192,7 @@ public class QueueResizingEsThreadPoolExecutorTests extends ESTestCase {
|
|||||||
|
|
||||||
private Function<Runnable, Runnable> fastWrapper() {
|
private Function<Runnable, Runnable> fastWrapper() {
|
||||||
return (runnable) -> {
|
return (runnable) -> {
|
||||||
return new SettableTimedRunnable(TimeUnit.NANOSECONDS.toNanos(50));
|
return new SettableTimedRunnable(TimeUnit.NANOSECONDS.toNanos(100));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user