1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Benchmark update.

This commit is contained in:
Cedric Beust 2015-11-09 22:13:50 -08:00
parent 87b2f3b982
commit 0fb1949174
2 changed files with 7 additions and 9 deletions

View file

@ -91,7 +91,7 @@ private class Main @Inject constructor(
var result = 0 var result = 0
val latestVersionFuture = github.latestKobaltVersion val latestVersionFuture = github.latestKobaltVersion
benchmark("Build", { val seconds = benchmark("build", {
// runTest() // runTest()
try { try {
result = runWithArgs(jc, args) 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 // Check for new version
val latestVersionString = latestVersionFuture.get() val latestVersionString = latestVersionFuture.get()
val latestVersion = Versions.toLongVersion(latestVersionString) val latestVersion = Versions.toLongVersion(latestVersionString)
val current = Versions.toLongVersion(Kobalt.version) val current = Versions.toLongVersion(Kobalt.version)
if (latestVersion > current) { if (latestVersion > current) {
"***** ".let { listOf("", "New Kobalt version available: $latestVersionString",
log(1, it) "To update, run ./kobaltw --update", "").forEach {
log(1, "$it New Kobalt version available: $latestVersionString") log(1, "**** $it")
log(1, "$it To update, run ./kobaltw --update")
log(1, it )
} }
} }
return result return result

View file

@ -1,8 +1,8 @@
package com.beust.kobalt.misc package com.beust.kobalt.misc
public fun benchmark(message: String, run: () -> Unit) { public fun benchmark(message: String, run: () -> Unit) : Long {
val start = System.currentTimeMillis() val start = System.currentTimeMillis()
run() run()
println("Time to $message: ${System.currentTimeMillis() - start} ms") return (System.currentTimeMillis() - start) / 1000
} }