Show estimated build end time during build
Ninja delivers estimated total build time and critical path time from
previous ninja log.
Bug: 292304818
Test: check if ETA shows
Change-Id: I014caaa3e8222a53c8822616b2ae31b88a3b0310
diff --git a/ui/status/status.go b/ui/status/status.go
index f3e58b6..da78994 100644
--- a/ui/status/status.go
+++ b/ui/status/status.go
@@ -19,6 +19,7 @@
import (
"sync"
+ "time"
)
// Action describes an action taken (or as Ninja calls them, Edges).
@@ -107,6 +108,8 @@
// FinishedActions are the number of actions that have been finished
// with FinishAction.
FinishedActions int
+
+ EstimatedTime time.Time
}
// ToolStatus is the interface used by tools to report on their Actions, and to
@@ -118,6 +121,7 @@
// This call be will ignored if it sets a number that is less than the
// current number of started actions.
SetTotalActions(total int)
+ SetEstimatedTime(estimatedTime time.Time)
// StartAction specifies that the associated action has been started by
// the tool.
@@ -267,6 +271,13 @@
s.counts.TotalActions += diff
}
+func (s *Status) SetEstimatedTime(estimatedTime time.Time) {
+ s.lock.Lock()
+ defer s.lock.Unlock()
+
+ s.counts.EstimatedTime = estimatedTime
+}
+
func (s *Status) startAction(action *Action) {
s.lock.Lock()
defer s.lock.Unlock()
@@ -329,6 +340,10 @@
}
}
+func (d *toolStatus) SetEstimatedTime(estimatedTime time.Time) {
+ d.status.SetEstimatedTime(estimatedTime)
+}
+
func (d *toolStatus) StartAction(action *Action) {
totalDiff := 0