Skip to content

Commit 5771c46

Browse files
committed
cleanup
1 parent c281e8d commit 5771c46

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/common/util/concurrent/ThreadPoolUtilizationBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import java.util.concurrent.TimeUnit;
2929

30-
@Threads(12)
30+
@Threads(Threads.MAX)
3131
@Warmup(iterations = 3, time = 200, timeUnit = TimeUnit.MILLISECONDS)
3232
@Measurement(iterations = 5, time = 600, timeUnit = TimeUnit.MILLISECONDS)
3333
@BenchmarkMode(Mode.SampleTime)
@@ -36,13 +36,13 @@
3636
@Fork(1)
3737
public class ThreadPoolUtilizationBenchmark {
3838

39-
@Param({ "10000" })
39+
@Param({ "1000" })
4040
private int callIntervalTicks;
4141

4242
/**
4343
* This makes very little difference, all the overhead is in the synchronization
4444
*/
45-
@Param({ "10" })
45+
@Param({ "30000" })
4646
private int utilizationIntervalMs;
4747
private TaskExecutionTimeTrackingEsThreadPoolExecutor.FramedTimeTracker timeTracker;
4848

server/src/main/java/org/elasticsearch/common/util/concurrent/TaskExecutionTimeTrackingEsThreadPoolExecutor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public TaskTrackingConfig trackingConfig() {
157157
* Utilization is measured as {@code all-threads-total-execution-time / (total-thread-count * interval)}.
158158
* This metric is updated once per interval, and returns last completed measurement. For example:
159159
* if interval is 30 seconds, at clock time 00:30-01:00 it will return utilization from 00:00-00:30.
160-
* Thou there is no synchronization with clocks and system time.
160+
* There is no synchronization with clocks and system time.
161161
*
162162
* If caller needs longer intervals it should poll on every tracker-interval and aggregate on it's own. Another option is to extend
163163
* framedTimeTracker to remember multiple past frames, and return aggregated view from here.
@@ -254,7 +254,7 @@ public boolean trackingMaxQueueLatency() {
254254
}
255255

256256
/**
257-
* Tracks treads execution in continuous, non-overlapping, and even time frames. Provides accurate total execution time measurement
257+
* Tracks threads execution in continuous, non-overlapping, and even time frames. Provides accurate total execution time measurement
258258
* for past frames, specifically previous frame (now - 1 frame) to measure utilization.
259259
*
260260
* Can be extended to remember multiple past frames.
@@ -327,7 +327,7 @@ public void startTask() {
327327
var now = timeNow.get();
328328
updateFrame0(now);
329329
ongoingTasks.incrementAndGet();
330-
currentTime.updateAndGet((t) -> t + (currentFrame.get() + 1) * interval - now);
330+
currentTime.addAndGet((now + 1) * interval - now);
331331
rwlock.readLock().unlock();
332332
}
333333

@@ -339,7 +339,7 @@ public void endTask() {
339339
var now = timeNow.get();
340340
updateFrame0(now);
341341
ongoingTasks.decrementAndGet();
342-
currentTime.updateAndGet((t) -> t - (currentFrame.get() + 1) * interval + now);
342+
currentTime.addAndGet(-((now + 1) * interval - now));
343343
rwlock.readLock().unlock();
344344
}
345345

0 commit comments

Comments
 (0)