Allow profiling Soong from the full build
Test: treehugger
Change-Id: I5112364fff635b856a55744457f547d3eba91391
diff --git a/ui/build/soong.go b/ui/build/soong.go
index c0bee4e..abaf5ae 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -195,6 +195,12 @@
allArgs = append(allArgs, commonArgs...)
allArgs = append(allArgs, environmentArgs(config, name)...)
+ if profileCpu := os.Getenv("SOONG_PROFILE_CPU"); profileCpu != "" {
+ allArgs = append(allArgs, "--cpuprofile", profileCpu+"."+name)
+ }
+ if profileMem := os.Getenv("SOONG_PROFILE_MEM"); profileMem != "" {
+ allArgs = append(allArgs, "--memprofile", profileMem+"."+name)
+ }
allArgs = append(allArgs, "Android.bp")
return bootstrap.PrimaryBuilderInvocation{