-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add printing total run duration (#1773)
- Loading branch information
1 parent
18a682f
commit 3a21357
Showing
14 changed files
with
159 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ftl.reports | ||
|
||
import flank.common.OutputLogLevel | ||
import flank.common.logLn | ||
import ftl.util.Duration | ||
import ftl.util.StopWatch | ||
import ftl.util.formatted | ||
|
||
val totalDurationStopWatch by lazy { StopWatch() } | ||
|
||
private val stepsTimes = mutableListOf<StepRunDuration>() | ||
|
||
data class StepRunDuration( | ||
val name: String, | ||
val duration: Duration | ||
) | ||
|
||
fun startDurationMeasurement() { | ||
totalDurationStopWatch.start() | ||
} | ||
|
||
fun addStepTime(name: String, duration: Duration) { | ||
stepsTimes.add(StepRunDuration(name, duration)) | ||
} | ||
|
||
fun printTotalDuration() { | ||
logLn(level = OutputLogLevel.DETAILED) | ||
logLn( | ||
"Total run duration: ${totalDurationStopWatch.check().formatted(alignSeconds = true)}", | ||
level = OutputLogLevel.DETAILED | ||
) | ||
stepsTimes.forEach { stepRunDuration -> | ||
logLn( | ||
"\t- ${stepRunDuration.name}: ${stepRunDuration.duration.formatted()}", | ||
level = OutputLogLevel.DETAILED | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.