This commit is contained in:
parent
a212aa300c
commit
f3d339a4a6
@ -1,10 +1,8 @@
|
||||
package com.kmlabz.k8s
|
||||
|
||||
import com.google.gson.GsonBuilder
|
||||
import io.ktor.application.*
|
||||
import io.ktor.util.*
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.File
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
|
||||
@ -18,7 +16,7 @@ fun Application.module(testing: Boolean = false) {
|
||||
var startTime: Instant
|
||||
var elapsed = Duration.ofSeconds(0)
|
||||
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
|
||||
var currIter = 1
|
||||
var currIter = 0
|
||||
val timestamps = LinkedHashMap<Int, Instant>()
|
||||
var currTimeStamp: Instant
|
||||
val uploader = Uploader()
|
||||
@ -27,17 +25,17 @@ fun Application.module(testing: Boolean = false) {
|
||||
println("Starting benchmark")
|
||||
startTime = Instant.now()
|
||||
while (elapsed < targetTime) {
|
||||
val job = GlobalScope.launch {
|
||||
uploader.uploadData(currIter)
|
||||
currIter += 1
|
||||
GlobalScope.launch {
|
||||
uploader.uploadData(currIter)
|
||||
currTimeStamp = Instant.now()
|
||||
timestamps[currIter] = currTimeStamp
|
||||
elapsed = Duration.between(startTime, currTimeStamp)
|
||||
}
|
||||
}
|
||||
println("Benchmark ended")
|
||||
processResults.mapToProcess = timestamps
|
||||
processResults.process()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user