mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Benchmark update.
This commit is contained in:
parent
87b2f3b982
commit
0fb1949174
2 changed files with 7 additions and 9 deletions
|
@ -91,7 +91,7 @@ private class Main @Inject constructor(
|
|||
|
||||
var result = 0
|
||||
val latestVersionFuture = github.latestKobaltVersion
|
||||
benchmark("Build", {
|
||||
val seconds = benchmark("build", {
|
||||
// runTest()
|
||||
try {
|
||||
result = runWithArgs(jc, args)
|
||||
|
@ -103,18 +103,16 @@ private class Main @Inject constructor(
|
|||
}
|
||||
})
|
||||
|
||||
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL")
|
||||
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
||||
|
||||
// Check for new version
|
||||
val latestVersionString = latestVersionFuture.get()
|
||||
val latestVersion = Versions.toLongVersion(latestVersionString)
|
||||
val current = Versions.toLongVersion(Kobalt.version)
|
||||
if (latestVersion > current) {
|
||||
"***** ".let {
|
||||
log(1, it)
|
||||
log(1, "$it New Kobalt version available: $latestVersionString")
|
||||
log(1, "$it To update, run ./kobaltw --update")
|
||||
log(1, it )
|
||||
listOf("", "New Kobalt version available: $latestVersionString",
|
||||
"To update, run ./kobaltw --update", "").forEach {
|
||||
log(1, "**** $it")
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.beust.kobalt.misc
|
||||
|
||||
public fun benchmark(message: String, run: () -> Unit) {
|
||||
public fun benchmark(message: String, run: () -> Unit) : Long {
|
||||
val start = System.currentTimeMillis()
|
||||
run()
|
||||
println("Time to $message: ${System.currentTimeMillis() - start} ms")
|
||||
return (System.currentTimeMillis() - start) / 1000
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue