This commit is contained in:
parent
afdd1ee4eb
commit
233b706d29
@ -17,30 +17,30 @@ fun Application.module(testing: Boolean = false) {
|
||||
runBlocking {
|
||||
val cachedFile = File("/app/wave.wav").readBytes()
|
||||
val gson = GsonBuilder().setPrettyPrinting().create()
|
||||
var startTime : Instant
|
||||
var startTime: Instant
|
||||
var elapsed = Duration.ofSeconds(0)
|
||||
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
|
||||
var currIter = 1
|
||||
val timestamps = LinkedHashMap<Int,Instant>()
|
||||
var currTimeStamp : Instant
|
||||
val timestamps = LinkedHashMap<Int, Instant>()
|
||||
var currTimeStamp: Instant
|
||||
val uploader = Uploader()
|
||||
val processResults = ProcessResults()
|
||||
environment.monitor.subscribe(ApplicationStarted) {
|
||||
val job = GlobalScope.launch {
|
||||
delay(3000L)
|
||||
println("Starting benchmark")
|
||||
startTime = Instant.now()
|
||||
while(elapsed < targetTime){
|
||||
println("Starting benchmark")
|
||||
startTime = Instant.now()
|
||||
while (elapsed < targetTime) {
|
||||
GlobalScope.launch {
|
||||
uploader.uploadData(currIter, gson, cachedFile)
|
||||
currIter+=1
|
||||
currTimeStamp = Instant.now()
|
||||
timestamps[currIter] = currTimeStamp
|
||||
elapsed = Duration.between(startTime, currTimeStamp)
|
||||
}
|
||||
println("Benchmark ended")
|
||||
processResults.mapToProcess = timestamps
|
||||
processResults.process()
|
||||
currIter += 1
|
||||
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