recommend a EventHandler.Do() am: 2a95e590b6 am: 0ca2d0cb67

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2095267

Change-Id: Ie3562a5645b24559b5b9ff7292262ea4c3ab0e09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Usta Shrestha 2022-05-31 16:54:18 +00:00 committed by Automerger Merge Worker
commit 36551c5a13
2 changed files with 8 additions and 1 deletions

View file

@ -3648,7 +3648,7 @@ func (c *Context) SingletonName(singleton Singleton) string {
return ""
}
// WriteBuildFile writes the Ninja manifeset text for the generated build
// WriteBuildFile writes the Ninja manifest text for the generated build
// actions to w. If this is called before PrepareBuildActions successfully
// completes then ErrBuildActionsNotReady is returned.
func (c *Context) WriteBuildFile(w io.StringWriter) error {

View file

@ -62,6 +62,13 @@ func (h *EventHandler) Begin(name string) {
h.scopeStartTimes = append(h.scopeStartTimes, _now())
}
// Do wraps a function with calls to Begin() and End().
func (h *EventHandler) Do(name string, f func()) {
h.Begin(name)
defer h.End(name)
f()
}
// End logs the end of an event. All events nested within this event must have
// themselves been marked completed.
func (h *EventHandler) End(name string) {