Skip to content

Commit

Permalink
Merge pull request #50 from eduardb/add-task-start-and-end-timestamps
Browse files Browse the repository at this point in the history
Add task start and end timestamps
  • Loading branch information
wzieba authored Jun 19, 2024
2 parents 2d91340 + 636b87d commit 9869f17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ abstract class BuildTaskService :
MeasuredTask(
name = event.descriptor?.name.toString(),
duration = (event.result.endTime - event.result.startTime).milliseconds,
startTimestamp = event.result.startTime,
endTimestamp = event.result.endTime,
state = when {
result.isFromCache -> IS_FROM_CACHE
result.isUpToDate -> UP_TO_DATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import kotlin.time.Duration
data class MeasuredTask(
val name: String,
val duration: Duration,
val startTimestamp: Long,
val endTimestamp: Long,
val state: State
) {
enum class State {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class BuildTimePluginTest {
assertThat(executionData.executedTasks).hasSize(1).first().satisfies({ task ->
assertThat(task.name).isEqualTo(":help")
assertThat(task.state).isEqualTo(MeasuredTask.State.EXECUTED)
assertThat(task.endTimestamp - task.startTimestamp).isEqualTo(task.duration.inWholeMilliseconds)
})
}
}
Expand Down

0 comments on commit 9869f17

Please sign in to comment.