Add top level and per-mutator traces to soong_build

- Top-level trace for all soong_build runs
  - Includes adding Peek() to OncePer because not all soong_build
    invocations have GenerateBuildActions run.
- A trace per mutator invocation

Test: m && build/bazel/scripts/print_analysis_metrics.py
Change-Id: Ief5c04630484fb38ec7e3757de45c7dc294d3b3c
diff --git a/android/onceper.go b/android/onceper.go
index 481cdea..fa415d1 100644
--- a/android/onceper.go
+++ b/android/onceper.go
@@ -79,6 +79,17 @@
 	return once.maybeWaitFor(key, v)
 }
 
+// Peek returns the value previously computed with Once for a given key.  If Once has not
+// been called for the given key Peek will return ok == false.
+func (once *OncePer) Peek(key OnceKey) (interface{}, bool) {
+	v, ok := once.values.Load(key)
+	if !ok {
+		return nil, false
+	}
+
+	return once.maybeWaitFor(key, v), true
+}
+
 // OnceStringSlice is the same as Once, but returns the value cast to a []string
 func (once *OncePer) OnceStringSlice(key OnceKey, value func() []string) []string {
 	return once.Once(key, func() interface{} { return value() }).([]string)