improved benchmark accuracy

This commit is contained in:
2025-02-05 19:10:25 +08:00
parent 7d0f24fa58
commit 53b24e3d54

View File

@@ -81,6 +81,8 @@ class BenchmarkCommand : GbcsCommand() {
semaphore.release()
completionCounter.incrementAndGet()
}
} else {
Thread.sleep(0)
}
}
@@ -103,9 +105,10 @@ class BenchmarkCommand : GbcsCommand() {
val completionCounter = AtomicLong(0)
val semaphore = Semaphore(profile.maxConnections * 3)
val start = Instant.now()
entries.forEach { entry ->
semaphore.acquire()
val it = entries.iterator()
while (completionCounter.get() < entries.size) {
if (it.hasNext()) {
val entry = it.next()
val future = client.get(entry.first).thenApply {
if (it == null) {
log.error {
@@ -121,6 +124,9 @@ class BenchmarkCommand : GbcsCommand() {
completionCounter.incrementAndGet()
semaphore.release()
}
} else {
Thread.sleep(0)
}
}
val end = Instant.now()
log.info {