This commit is contained in:
parent
a4c9bd854e
commit
a212aa300c
@ -15,21 +15,21 @@ fun main(args: Array<String>): Unit = io.ktor.server.tomcat.EngineMain.main(args
|
|||||||
@kotlin.jvm.JvmOverloads
|
@kotlin.jvm.JvmOverloads
|
||||||
fun Application.module(testing: Boolean = false) {
|
fun Application.module(testing: Boolean = false) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
var startTime : Instant
|
var startTime: Instant
|
||||||
var elapsed = Duration.ofSeconds(0)
|
var elapsed = Duration.ofSeconds(0)
|
||||||
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
|
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
|
||||||
var currIter = 1
|
var currIter = 1
|
||||||
val timestamps = LinkedHashMap<Int,Instant>()
|
val timestamps = LinkedHashMap<Int, Instant>()
|
||||||
var currTimeStamp : Instant
|
var currTimeStamp: Instant
|
||||||
val uploader = Uploader()
|
val uploader = Uploader()
|
||||||
val processResults = ProcessResults()
|
val processResults = ProcessResults()
|
||||||
environment.monitor.subscribe(ApplicationStarted) {
|
environment.monitor.subscribe(ApplicationStarted) {
|
||||||
val job = GlobalScope.launch {
|
|
||||||
println("Starting benchmark")
|
println("Starting benchmark")
|
||||||
startTime = Instant.now()
|
startTime = Instant.now()
|
||||||
while(elapsed < targetTime){
|
while (elapsed < targetTime) {
|
||||||
|
val job = GlobalScope.launch {
|
||||||
uploader.uploadData(currIter)
|
uploader.uploadData(currIter)
|
||||||
currIter+=1
|
currIter += 1
|
||||||
currTimeStamp = Instant.now()
|
currTimeStamp = Instant.now()
|
||||||
timestamps[currIter] = currTimeStamp
|
timestamps[currIter] = currTimeStamp
|
||||||
elapsed = Duration.between(startTime, currTimeStamp)
|
elapsed = Duration.between(startTime, currTimeStamp)
|
||||||
|
Loading…
Reference in New Issue
Block a user