Add a new field to the SpawnExecutedEvent that records the start time in nanos.
There can be many spawns per action and each starting at a different time. Recording the start time of the spawn can be beneficial for anything consuming the SpawnExecutedEvent.
RELNOTES: None.
@@ -16,17 +16,18 @@ package com.google.devtools.build.lib.actions;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.events.ExtendedEventHandler;
+import java.time.Instant;
/** This event is fired during the build, when a subprocess is executed. */
public class SpawnExecutedEvent implements ExtendedEventHandler.ProgressLike {
private final Spawn spawn;
private final SpawnResult result;
+ private final Instant startTimeInstant;
- public SpawnExecutedEvent(
- Spawn spawn,
- SpawnResult result) {
+ public SpawnExecutedEvent(Spawn spawn, SpawnResult result, Instant startTimeInstant) {
this.spawn = Preconditions.checkNotNull(spawn);
this.result = Preconditions.checkNotNull(result);
+ this.startTimeInstant = startTimeInstant;
}
/** Returns the Spawn. */
@@ -49,6 +50,11 @@ public class SpawnExecutedEvent implements ExtendedEventHandler.ProgressLike {
return result;
}
+ /** Returns the instant in time when the spawn starts. */
+ public Instant getStartTimeInstant() {
+ return startTimeInstant;
+ }
+
/**
* This event is fired to differentiate actions with multiple spawns that are run sequentially
* versus parallel. An example of a use case of why this would be important is if we have flaky
