blob: 190c955ffd06669775a566b31e9443f59b01916c [file] [log] [blame]
Dan Willemsen1e704462016-08-21 15:17:17 -07001// Copyright 2017 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package build
16
17import (
Colin Crossb72c9092020-02-10 11:23:49 -080018 "io/ioutil"
Dan Willemsen99a75cd2017-08-04 16:04:04 -070019 "os"
Dan Willemsen1e704462016-08-21 15:17:17 -070020 "path/filepath"
Dan Willemsen99a75cd2017-08-04 16:04:04 -070021 "strconv"
Dan Willemsen99a75cd2017-08-04 16:04:04 -070022
Dan Willemsen4591b642021-05-24 14:24:12 -070023 "android/soong/ui/metrics"
Colin Crossb72c9092020-02-10 11:23:49 -080024 soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
Dan Willemsen4591b642021-05-24 14:24:12 -070025 "android/soong/ui/status"
26
27 "android/soong/shared"
28
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010029 "github.com/google/blueprint"
30 "github.com/google/blueprint/bootstrap"
Dan Willemsen4591b642021-05-24 14:24:12 -070031 "github.com/google/blueprint/deptools"
Dan Willemsen99a75cd2017-08-04 16:04:04 -070032 "github.com/google/blueprint/microfactory"
Dan Willemsenb82471a2018-05-17 16:37:09 -070033
Dan Willemsen4591b642021-05-24 14:24:12 -070034 "google.golang.org/protobuf/proto"
Dan Willemsen1e704462016-08-21 15:17:17 -070035)
36
Lukacs T. Berkif8e24282021-04-14 10:31:00 +020037const (
38 availableEnvFile = "soong.environment.available"
39 usedEnvFile = "soong.environment.used"
40)
41
Lukacs T. Berki7690c092021-02-26 14:27:36 +010042func writeEnvironmentFile(ctx Context, envFile string, envDeps map[string]string) error {
43 data, err := shared.EnvFileContents(envDeps)
44 if err != nil {
45 return err
46 }
47
48 return ioutil.WriteFile(envFile, data, 0644)
49}
50
Rupert Shuttleworthb7d97102020-11-25 10:19:29 +000051// This uses Android.bp files and various tools to generate <builddir>/build.ninja.
52//
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010053// However, the execution of <builddir>/build.ninja happens later in
54// build/soong/ui/build/build.go#Build()
Rupert Shuttleworthb7d97102020-11-25 10:19:29 +000055//
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010056// We want to rely on as few prebuilts as possible, so we need to bootstrap
57// Soong. The process is as follows:
Rupert Shuttleworthb7d97102020-11-25 10:19:29 +000058//
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010059// 1. We use "Microfactory", a simple tool to compile Go code, to build
60// first itself, then soong_ui from soong_ui.bash. This binary contains
61// parts of soong_build that are needed to build itself.
62// 2. This simplified version of soong_build then reads the Blueprint files
63// that describe itself and emits .bootstrap/build.ninja that describes
64// how to build its full version and use that to produce the final Ninja
65// file Soong emits.
66// 3. soong_ui executes .bootstrap/build.ninja
Rupert Shuttleworthb7d97102020-11-25 10:19:29 +000067//
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010068// (After this, Kati is executed to parse the Makefiles, but that's not part of
69// bootstrapping Soong)
70
71// A tiny struct used to tell Blueprint that it's in bootstrap mode. It would
72// probably be nicer to use a flag in bootstrap.Args instead.
73type BlueprintConfig struct {
Lukacs T. Berki5f6cb1d2021-03-17 15:03:14 +010074 srcDir string
75 buildDir string
76 ninjaBuildDir string
77 debugCompilation bool
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010078}
79
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +010080func (c BlueprintConfig) SrcDir() string {
81 return "."
82}
83
84func (c BlueprintConfig) BuildDir() string {
85 return c.buildDir
86}
87
88func (c BlueprintConfig) NinjaBuildDir() string {
89 return c.ninjaBuildDir
90}
91
Lukacs T. Berki5f6cb1d2021-03-17 15:03:14 +010092func (c BlueprintConfig) DebugCompilation() bool {
93 return c.debugCompilation
94}
95
Lukacs T. Berkif8e24282021-04-14 10:31:00 +020096func environmentArgs(config Config, suffix string) []string {
97 return []string{
98 "--available_env", shared.JoinPath(config.SoongOutDir(), availableEnvFile),
99 "--used_env", shared.JoinPath(config.SoongOutDir(), usedEnvFile+suffix),
100 }
101}
Spandan Das8f99ae62021-06-11 16:48:06 +0000102
103func writeEmptyGlobFile(ctx Context, path string) {
104 err := os.MkdirAll(filepath.Dir(path), 0777)
105 if err != nil {
106 ctx.Fatalf("Failed to create parent directories of empty ninja glob file '%s': %s", path, err)
107 }
108
109 if _, err := os.Stat(path); os.IsNotExist(err) {
110 err = ioutil.WriteFile(path, nil, 0666)
111 if err != nil {
112 ctx.Fatalf("Failed to create empty ninja glob file '%s': %s", path, err)
113 }
114 }
115}
116
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200117func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100118 ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
119 defer ctx.EndTrace()
120
121 var args bootstrap.Args
122
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200123 mainNinjaFile := shared.JoinPath(config.SoongOutDir(), "build.ninja")
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200124 bootstrapGlobFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build-globs.ninja")
Spandan Das8f99ae62021-06-11 16:48:06 +0000125 // .bootstrap/build.ninja "includes" .bootstrap/build-globs.ninja for incremental builds
126 // generate an empty glob before running any rule in .bootstrap/build.ninja
127 writeEmptyGlobFile(ctx, bootstrapGlobFile)
Lukacs T. Berkid518e1a2021-04-14 13:49:50 +0200128 bootstrapDepFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja.d")
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200129
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100130 args.RunGoTests = !config.skipSoongTests
131 args.UseValidations = true // Use validations to depend on tests
132 args.BuildDir = config.SoongOutDir()
133 args.NinjaBuildDir = config.OutDir()
134 args.TopFile = "Android.bp"
135 args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list")
136 args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja")
Spandan Das8f99ae62021-06-11 16:48:06 +0000137 // The primary builder (aka soong_build) will use bootstrapGlobFile as the globFile to generate build.ninja(.d)
138 // Building soong_build does not require a glob file
139 // Using "" instead of "<soong_build_glob>.ninja" will ensure that an unused glob file is not written to out/soong/.bootstrap during StagePrimary
140 args.GlobFile = ""
Lukacs T. Berkid7ce8402021-03-17 14:03:51 +0100141 args.GeneratingPrimaryBuilder = true
Colin Crossf3bdbcb2021-06-01 11:43:55 -0700142 args.EmptyNinjaFile = config.EmptyNinjaFile()
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100143
Lukacs T. Berki745380c2021-04-12 12:07:44 +0200144 args.DelveListen = os.Getenv("SOONG_DELVE")
145 if args.DelveListen != "" {
146 args.DelvePath = shared.ResolveDelveBinary()
147 }
148
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200149 commonArgs := bootstrap.PrimaryBuilderExtraFlags(args, bootstrapGlobFile, mainNinjaFile)
150 bp2BuildMarkerFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/bp2build_workspace_marker")
151 mainSoongBuildInputs := []string{"Android.bp"}
152
153 if integratedBp2Build {
154 mainSoongBuildInputs = append(mainSoongBuildInputs, bp2BuildMarkerFile)
155 }
156
157 soongBuildArgs := make([]string, 0)
158 soongBuildArgs = append(soongBuildArgs, commonArgs...)
159 soongBuildArgs = append(soongBuildArgs, environmentArgs(config, "")...)
160 soongBuildArgs = append(soongBuildArgs, "Android.bp")
161
162 mainSoongBuildInvocation := bootstrap.PrimaryBuilderInvocation{
163 Inputs: mainSoongBuildInputs,
164 Outputs: []string{mainNinjaFile},
165 Args: soongBuildArgs,
166 }
167
168 if integratedBp2Build {
169 bp2buildArgs := []string{"--bp2build_marker", bp2BuildMarkerFile}
170 bp2buildArgs = append(bp2buildArgs, commonArgs...)
171 bp2buildArgs = append(bp2buildArgs, environmentArgs(config, ".bp2build")...)
172 bp2buildArgs = append(bp2buildArgs, "Android.bp")
173
174 bp2buildInvocation := bootstrap.PrimaryBuilderInvocation{
175 Inputs: []string{"Android.bp"},
176 Outputs: []string{bp2BuildMarkerFile},
177 Args: bp2buildArgs,
178 }
Jingwen Chen4fabaf52021-05-25 02:40:29 +0000179 args.PrimaryBuilderInvocations = []bootstrap.PrimaryBuilderInvocation{bp2buildInvocation}
180 if config.bazelBuildMode() == mixedBuild {
181 args.PrimaryBuilderInvocations = append(args.PrimaryBuilderInvocations, mainSoongBuildInvocation)
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200182 }
183 } else {
184 args.PrimaryBuilderInvocations = []bootstrap.PrimaryBuilderInvocation{mainSoongBuildInvocation}
185 }
186
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100187 blueprintCtx := blueprint.NewContext()
188 blueprintCtx.SetIgnoreUnknownModuleTypes(true)
189 blueprintConfig := BlueprintConfig{
Lukacs T. Berki5f6cb1d2021-03-17 15:03:14 +0100190 srcDir: os.Getenv("TOP"),
191 buildDir: config.SoongOutDir(),
192 ninjaBuildDir: config.OutDir(),
193 debugCompilation: os.Getenv("SOONG_DELVE") != "",
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100194 }
195
Lukacs T. Berkid518e1a2021-04-14 13:49:50 +0200196 bootstrapDeps := bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)
197 err := deptools.WriteDepFile(bootstrapDepFile, args.OutFile, bootstrapDeps)
198 if err != nil {
199 ctx.Fatalf("Error writing depfile '%s': %s", bootstrapDepFile, err)
200 }
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100201}
202
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200203func checkEnvironmentFile(currentEnv *Environment, envFile string) {
204 getenv := func(k string) string {
205 v, _ := currentEnv.Get(k)
206 return v
207 }
208 if stale, _ := shared.StaleEnvFile(envFile, getenv); stale {
209 os.Remove(envFile)
210 }
211}
212
Dan Willemsen1e704462016-08-21 15:17:17 -0700213func runSoong(ctx Context, config Config) {
Nan Zhang17f27672018-12-12 16:01:49 -0800214 ctx.BeginTrace(metrics.RunSoong, "soong")
Dan Willemsend9f6fa22016-08-21 15:17:17 -0700215 defer ctx.EndTrace()
216
Lukacs T. Berki7690c092021-02-26 14:27:36 +0100217 // We have two environment files: .available is the one with every variable,
218 // .used with the ones that were actually used. The latter is used to
219 // determine whether Soong needs to be re-run since why re-run it if only
220 // unused variables were changed?
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200221 envFile := filepath.Join(config.SoongOutDir(), availableEnvFile)
Lukacs T. Berki7690c092021-02-26 14:27:36 +0100222
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100223 for _, n := range []string{".bootstrap", ".minibootstrap"} {
224 dir := filepath.Join(config.SoongOutDir(), n)
225 if err := os.MkdirAll(dir, 0755); err != nil {
226 ctx.Fatalf("Cannot mkdir " + dir)
Colin Cross00a8a3f2020-10-29 14:08:31 -0700227 }
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100228 }
Colin Cross00a8a3f2020-10-29 14:08:31 -0700229
Chris Parsonsec1a3dc2021-04-20 15:32:07 -0400230 buildMode := config.bazelBuildMode()
231 integratedBp2Build := (buildMode == mixedBuild) || (buildMode == generateBuildFiles)
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200232
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100233 // This is done unconditionally, but does not take a measurable amount of time
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200234 bootstrapBlueprint(ctx, config, integratedBp2Build)
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700235
Lukacs T. Berki7690c092021-02-26 14:27:36 +0100236 soongBuildEnv := config.Environment().Copy()
237 soongBuildEnv.Set("TOP", os.Getenv("TOP"))
Lukacs T. Berki7690c092021-02-26 14:27:36 +0100238 // For Bazel mixed builds.
239 soongBuildEnv.Set("BAZEL_PATH", "./tools/bazel")
240 soongBuildEnv.Set("BAZEL_HOME", filepath.Join(config.BazelOutDir(), "bazelhome"))
241 soongBuildEnv.Set("BAZEL_OUTPUT_BASE", filepath.Join(config.BazelOutDir(), "output"))
242 soongBuildEnv.Set("BAZEL_WORKSPACE", absPath(ctx, "."))
243 soongBuildEnv.Set("BAZEL_METRICS_DIR", config.BazelMetricsDir())
244
Lukacs T. Berkid1e3f1f2021-03-16 08:55:23 +0100245 // For Soong bootstrapping tests
246 if os.Getenv("ALLOW_MISSING_DEPENDENCIES") == "true" {
247 soongBuildEnv.Set("ALLOW_MISSING_DEPENDENCIES", "true")
248 }
249
Paul Duffin5e85c662021-03-05 12:26:14 +0000250 err := writeEnvironmentFile(ctx, envFile, soongBuildEnv.AsMap())
251 if err != nil {
252 ctx.Fatalf("failed to write environment file %s: %s", envFile, err)
253 }
Lukacs T. Berki7690c092021-02-26 14:27:36 +0100254
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700255 func() {
Nan Zhang17f27672018-12-12 16:01:49 -0800256 ctx.BeginTrace(metrics.RunSoong, "environment check")
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700257 defer ctx.EndTrace()
258
Lukacs T. Berkif8e24282021-04-14 10:31:00 +0200259 soongBuildEnvFile := filepath.Join(config.SoongOutDir(), usedEnvFile)
260 checkEnvironmentFile(soongBuildEnv, soongBuildEnvFile)
261
262 if integratedBp2Build {
263 bp2buildEnvFile := filepath.Join(config.SoongOutDir(), usedEnvFile+".bp2build")
264 checkEnvironmentFile(soongBuildEnv, bp2buildEnvFile)
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700265 }
266 }()
267
Sasha Smundak7ae80a72021-04-09 12:03:51 -0700268 runMicrofactory(ctx, config, ".minibootstrap/bpglob", "github.com/google/blueprint/bootstrap/bpglob",
269 map[string]string{"github.com/google/blueprint": "build/blueprint"})
Dan Willemsen5af1cbe2018-07-05 21:46:51 -0700270
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700271 ninja := func(name, file string) {
Nan Zhang17f27672018-12-12 16:01:49 -0800272 ctx.BeginTrace(metrics.RunSoong, name)
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700273 defer ctx.EndTrace()
274
Dan Willemsenb82471a2018-05-17 16:37:09 -0700275 fifo := filepath.Join(config.OutDir(), ".ninja_fifo")
Colin Crossb98d3bc2019-03-21 16:02:58 -0700276 nr := status.NewNinjaReader(ctx, ctx.Status.StartTool(), fifo)
277 defer nr.Close()
Dan Willemsenb82471a2018-05-17 16:37:09 -0700278
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700279 cmd := Command(ctx, config, "soong "+name,
280 config.PrebuiltBuildTool("ninja"),
281 "-d", "keepdepfile",
Dan Willemsen08218222020-05-18 14:02:02 -0700282 "-d", "stats",
Dan Willemsen6587bed2020-04-18 20:25:59 -0700283 "-o", "usesphonyoutputs=yes",
284 "-o", "preremoveoutputs=yes",
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700285 "-w", "dupbuild=err",
Dan Willemsen6587bed2020-04-18 20:25:59 -0700286 "-w", "outputdir=err",
287 "-w", "missingoutfile=err",
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700288 "-j", strconv.Itoa(config.Parallel()),
Dan Willemsen02736672018-07-17 17:54:31 -0700289 "--frontend_file", fifo,
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700290 "-f", filepath.Join(config.SoongOutDir(), file))
Jingwen Chen7c6089a2020-11-02 02:56:20 -0500291
Lukacs T. Berkib14ad7b2021-03-09 10:43:57 +0100292 var ninjaEnv Environment
Lukacs T. Berki73ab9282021-03-10 10:48:39 +0100293
294 // This is currently how the command line to invoke soong_build finds the
295 // root of the source tree and the output root
Lukacs T. Berkib14ad7b2021-03-09 10:43:57 +0100296 ninjaEnv.Set("TOP", os.Getenv("TOP"))
Lukacs T. Berki7d613bf2021-03-02 10:09:41 +0100297
Lukacs T. Berkib14ad7b2021-03-09 10:43:57 +0100298 cmd.Environment = &ninjaEnv
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700299 cmd.Sandbox = soongSandbox
Colin Cross7b97ecd2019-06-19 13:17:59 -0700300 cmd.RunAndStreamOrFatal()
Dan Willemsen1e704462016-08-21 15:17:17 -0700301 }
Rupert Shuttleworthb7d97102020-11-25 10:19:29 +0000302 // This build generates <builddir>/build.ninja, which is used later by build/soong/ui/build/build.go#Build().
Dan Willemsen99a75cd2017-08-04 16:04:04 -0700303 ninja("bootstrap", ".bootstrap/build.ninja")
Colin Crossb72c9092020-02-10 11:23:49 -0800304
Jingwen Cheneb76c432021-01-28 08:22:12 -0500305 var soongBuildMetrics *soong_metrics_proto.SoongBuildMetrics
306 if shouldCollectBuildSoongMetrics(config) {
307 soongBuildMetrics := loadSoongBuildMetrics(ctx, config)
308 logSoongBuildMetrics(ctx, soongBuildMetrics)
309 }
Colin Crossb72c9092020-02-10 11:23:49 -0800310
Colin Cross8ba7d472020-06-25 11:27:52 -0700311 distGzipFile(ctx, config, config.SoongNinjaFile(), "soong")
312
Anton Hansson5e5c48b2020-11-27 12:35:20 +0000313 if !config.SkipKati() {
Colin Cross8ba7d472020-06-25 11:27:52 -0700314 distGzipFile(ctx, config, config.SoongAndroidMk(), "soong")
315 distGzipFile(ctx, config, config.SoongMakeVarsMk(), "soong")
316 }
317
Jingwen Cheneb76c432021-01-28 08:22:12 -0500318 if shouldCollectBuildSoongMetrics(config) && ctx.Metrics != nil {
Colin Crossb72c9092020-02-10 11:23:49 -0800319 ctx.Metrics.SetSoongBuildMetrics(soongBuildMetrics)
320 }
321}
322
Sasha Smundak7ae80a72021-04-09 12:03:51 -0700323func runMicrofactory(ctx Context, config Config, relExePath string, pkg string, mapping map[string]string) {
324 name := filepath.Base(relExePath)
325 ctx.BeginTrace(metrics.RunSoong, name)
326 defer ctx.EndTrace()
327 cfg := microfactory.Config{TrimPath: absPath(ctx, ".")}
328 for pkgPrefix, pathPrefix := range mapping {
329 cfg.Map(pkgPrefix, pathPrefix)
330 }
331
332 exePath := filepath.Join(config.SoongOutDir(), relExePath)
333 dir := filepath.Dir(exePath)
334 if err := os.MkdirAll(dir, 0777); err != nil {
335 ctx.Fatalf("cannot create %s: %s", dir, err)
336 }
337 if _, err := microfactory.Build(&cfg, exePath, pkg); err != nil {
338 ctx.Fatalf("failed to build %s: %s", name, err)
339 }
340}
341
Jingwen Cheneb76c432021-01-28 08:22:12 -0500342func shouldCollectBuildSoongMetrics(config Config) bool {
Jingwen Chendd9725c2021-06-24 08:41:16 +0000343 // Do not collect metrics protobuf if the soong_build binary ran as the
344 // bp2build converter or the JSON graph dump.
345 return config.bazelBuildMode() != generateBuildFiles && config.bazelBuildMode() != generateJsonModuleGraph
Jingwen Cheneb76c432021-01-28 08:22:12 -0500346}
347
Colin Crossb72c9092020-02-10 11:23:49 -0800348func loadSoongBuildMetrics(ctx Context, config Config) *soong_metrics_proto.SoongBuildMetrics {
349 soongBuildMetricsFile := filepath.Join(config.OutDir(), "soong", "soong_build_metrics.pb")
350 buf, err := ioutil.ReadFile(soongBuildMetricsFile)
351 if err != nil {
352 ctx.Fatalf("Failed to load %s: %s", soongBuildMetricsFile, err)
353 }
354 soongBuildMetrics := &soong_metrics_proto.SoongBuildMetrics{}
355 err = proto.Unmarshal(buf, soongBuildMetrics)
356 if err != nil {
357 ctx.Fatalf("Failed to unmarshal %s: %s", soongBuildMetricsFile, err)
358 }
359 return soongBuildMetrics
360}
361
362func logSoongBuildMetrics(ctx Context, metrics *soong_metrics_proto.SoongBuildMetrics) {
363 ctx.Verbosef("soong_build metrics:")
364 ctx.Verbosef(" modules: %v", metrics.GetModules())
365 ctx.Verbosef(" variants: %v", metrics.GetVariants())
366 ctx.Verbosef(" max heap size: %v MB", metrics.GetMaxHeapSize()/1e6)
367 ctx.Verbosef(" total allocation count: %v", metrics.GetTotalAllocCount())
368 ctx.Verbosef(" total allocation size: %v MB", metrics.GetTotalAllocSize()/1e6)
369
Dan Willemsen1e704462016-08-21 15:17:17 -0700370}