Lines Matching full:metrics

15 // Package metrics represents the metrics system for Android Platform Build Systems.
16 package metrics package
18 // This is the main heart of the metrics system for Android Platform Build Systems.
19 // The starting of the soong_ui (cmd/soong_ui/main.go), the metrics system is
25 // that captures the metrics and is them added as a perfInfo into the set
26 // of the collected metrics. Finally, when soong_ui has finished the build,
27 // the defer Dump function is invoked to store the collected metrics to the
31 // defined in cmd/soong_ui/main.go. See ui/metrics/event.go for the explanation
32 // of what an event is and how the metrics system is a stack based system.
44 soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
45 mk_metrics_proto "android/soong/ui/metrics/mk_metrics_proto"
50 // names are used to group a set of metrics.
67 // Metrics is a struct that stores collected metrics during the course of a
68 // build. It is later dumped to protobuf files. See underlying metrics protos
70 type Metrics struct { struct
71 // Protobuf containing various top-level build metrics. These include:
74 // 2. Per-subprocess top-level metrics (ex: ninja process IO and runtime).
75 // Note that, since these metrics are reported by soong_ui, there is little
78 metrics soong_metrics_proto.MetricsBase member
80 // Protobuf containing metrics pertaining to number of makefiles in a build.
87 // New returns a pointer of Metrics to store a set of metrics.
88 func New() (metrics *Metrics) {
89 m := &Metrics{
90 metrics: soong_metrics_proto.MetricsBase{},
97 func (m *Metrics) SetTotalMakefiles(total int) { argument
101 func (m *Metrics) SetToplevelMakefiles(total int) { argument
105 func (m *Metrics) DumpMkMetrics(outPath string) { argument
111 func (m *Metrics) SetTimeMetrics(perf soong_metrics_proto.PerfInfo) { argument
114 m.metrics.KatiRuns = append(m.metrics.KatiRuns, &perf)
116 m.metrics.SoongRuns = append(m.metrics.SoongRuns, &perf)
118 m.metrics.BazelRuns = append(m.metrics.BazelRuns, &perf)
120 m.metrics.NinjaRuns = append(m.metrics.NinjaRuns, &perf)
122 m.metrics.SetupTools = append(m.metrics.SetupTools, &perf)
124 m.metrics.Total = &perf
128 func (m *Metrics) SetCriticalPathInfo(criticalPathInfo soong_metrics_proto.CriticalPathInfo) { argument
129 m.metrics.CriticalPathInfo = &criticalPathInfo
133 // available or the metrics base.
134 func (m *Metrics) SetFatalOrPanicMessage(errMsg string) { argument
142 m.metrics.ErrorMessage = proto.String(errMsg)
144 m.metrics.NonZeroExit = proto.Bool(true)
148 func (m *Metrics) BuildConfig(b *soong_metrics_proto.BuildConfig) { argument
149 m.metrics.BuildConfig = b
154 func (m *Metrics) SystemResourceInfo(b *soong_metrics_proto.SystemResourceInfo) { argument
155 m.metrics.SystemResourceInfo = b
159 func (m *Metrics) ExpConfigFetcher(b *soong_metrics_proto.ExpConfigFetcher) { argument
160 m.metrics.ExpConfigFetcher = b
165 func (m *Metrics) SetMetadataMetrics(metadata map[string]string) { argument
169 m.metrics.BuildId = proto.String(v)
171 m.metrics.PlatformVersionCodename = proto.String(v)
173 m.metrics.TargetProduct = proto.String(v)
177 m.metrics.TargetBuildVariant = soong_metrics_proto.MetricsBase_USER.Enum()
179 m.metrics.TargetBuildVariant = soong_metrics_proto.MetricsBase_USERDEBUG.Enum()
181 m.metrics.TargetBuildVariant = soong_metrics_proto.MetricsBase_ENG.Enum()
184 m.metrics.TargetArch = arch(v)
186 m.metrics.TargetArchVariant = proto.String(v)
188 m.metrics.TargetCpuVariant = proto.String(v)
190 m.metrics.HostArch = arch(v)
192 m.metrics.Host_2NdArch = arch(v)
194 m.metrics.HostOsExtra = proto.String(v)
196 m.metrics.HostCrossOs = proto.String(v)
198 m.metrics.HostCrossArch = proto.String(v)
200 m.metrics.HostCross_2NdArch = proto.String(v)
202 m.metrics.OutDir = proto.String(v)
226 func (m *Metrics) SetBuildDateTime(buildTimestamp time.Time) { argument
227 m.metrics.BuildDateTimestamp = proto.Int64(buildTimestamp.UnixNano() / int64(time.Second))
231 // list of collected metrics.
232 func (m *Metrics) SetBuildCommand(cmd []string) { argument
233 m.metrics.BuildCommand = proto.String(strings.Join(cmd, " "))
238 func (m *Metrics) AddChangedEnvironmentVariable(ChangedEnvironmentVariable string) { argument
239 m.metrics.ChangedEnvironmentVariable = append(m.metrics.ChangedEnvironmentVariable,
243 // Dump exports the collected metrics from the executed build to the file at
245 func (m *Metrics) Dump(out string) error { argument
249 m.metrics.Hostname = proto.String(hostname)
251 m.metrics.HostOs = proto.String(runtime.GOOS)
253 return shared.Save(&m.metrics, out)
256 // SetSoongBuildMetrics sets the metrics collected from the soong_build
258 func (m *Metrics) SetSoongBuildMetrics(metrics *soong_metrics_proto.SoongBuildMetrics) { argument
259 m.metrics.SoongBuildMetrics = metrics
263 // metrics. These critical user journeys are defined under cuj/cuj.go file.
265 // A list of collected CUJ metrics.
270 // to capture CUJs metrics.
275 // Add adds a set of collected metrics from an executed critical user journey.
276 func (c *CriticalUserJourneysMetrics) Add(name string, metrics *Metrics) {
279 Metrics: &metrics.metrics,
283 // Dump saves the collected CUJs metrics to the raw protobuf file.