diff --git a/context.go b/context.go index f49f654..aa9c5c6 100644 --- a/context.go +++ b/context.go @@ -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 { diff --git a/metrics/event_handler.go b/metrics/event_handler.go index c19d039..f6bcaf1 100644 --- a/metrics/event_handler.go +++ b/metrics/event_handler.go @@ -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) {