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.
PiperOrigin-RevId: 293416996
diff --git a/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
index b07061d..e25004b 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
@@ -16,17 +16,18 @@
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 @@
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