diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionResult.java b/src/main/java/com/google/devtools/build/lib/actions/ActionResult.java index 9b700e26f4c01a..eebdbcea622149 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionResult.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionResult.java @@ -164,6 +164,106 @@ public Optional cumulativeCommandExecutionMemoryInKb() { return getCumulativeLong(SpawnResult::getMemoryInKb); } + /** + * Returns the cumulative spawns total time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsTotalTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().totalTime())); + } + + /** + * Returns the cumulative spawns parse time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsParseTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().parseTime())); + } + + /** + * Returns the cumulative spawns network time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsNetworkTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().networkTime())); + } + + /** + * Returns the cumulative spawns fetch time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsFetchTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().fetchTime())); + } + + /** + * Returns the cumulative spawns queue time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsQueueTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().queueTime())); + } + + /** + * Returns the cumulative spawns setup time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsSetupTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().setupTime())); + } + + /** + * Returns the cumulative spawns upload time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeSpawnsUploadTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().uploadTime())); + } + + /** + * Returns the cumulative spawns execution wall time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeExecutionWallTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().executionWallTime())); + } + + /** + * Returns the cumulative spawns process output time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeProcessOutputTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().processOutputsTime())); + } + + /** + * Returns the cumulative spawns retry time for the {@link Action}. + * + * @return the cumulative measurement, or empty in case of execution errors or when the + * measurement is not implemented for the current platform + */ + public Optional cumulativeRetryTime() { + return getCumulativeTime(s -> Optional.of(s.getMetrics().retryTime())); + } + /** * Indicates whether all {@link Spawn}s executed locally or not. *