Loading docs/perf.md +17 −4 Original line number Diff line number Diff line Loading @@ -49,9 +49,22 @@ in the build graph will improve total build times. ### Soong Soong can be traced and profiled using the standard Go tools. It understands the `-cpuprofile`, `-trace`, and `-memprofile` command line arguments, but we don't currently have an easy way to enable them in the context of a full build. Soong proper (i.e., `soong_build` executable that processes the blueprint files) can be traced and profiled using the standard Go tools. It understands the `-trace`, `-cpuprofile`, and `-memprofile` command line arguments. Setting `SOONG_PROFILE_CPU` and/or `SOONG_PROFILE_MEM` environment variables for the build enables respective profiling, e.g., running ```shell SOONG_PROFILE_CPU=/tmp/foo m ..._ ``` saves CPU profile for each Soong invocation in /tmp/foo._step_ file, where _step_ is Soong execution step. The main step is `build`. The others as `bp2build_files`, `bp2build_workspace`, `modulegraph`, `queryview`, `api_bp2build`, `soong_docs` (not all of them necessarily run during the build). The profiles can be inspected with `go tool pprof` from the command line or with _Run>Open Profiler Snapshot_ in IntelliJ IDEA. ### Kati Loading ui/build/soong.go +6 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,12 @@ func primaryBuilderInvocation( 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{ Loading Loading
docs/perf.md +17 −4 Original line number Diff line number Diff line Loading @@ -49,9 +49,22 @@ in the build graph will improve total build times. ### Soong Soong can be traced and profiled using the standard Go tools. It understands the `-cpuprofile`, `-trace`, and `-memprofile` command line arguments, but we don't currently have an easy way to enable them in the context of a full build. Soong proper (i.e., `soong_build` executable that processes the blueprint files) can be traced and profiled using the standard Go tools. It understands the `-trace`, `-cpuprofile`, and `-memprofile` command line arguments. Setting `SOONG_PROFILE_CPU` and/or `SOONG_PROFILE_MEM` environment variables for the build enables respective profiling, e.g., running ```shell SOONG_PROFILE_CPU=/tmp/foo m ..._ ``` saves CPU profile for each Soong invocation in /tmp/foo._step_ file, where _step_ is Soong execution step. The main step is `build`. The others as `bp2build_files`, `bp2build_workspace`, `modulegraph`, `queryview`, `api_bp2build`, `soong_docs` (not all of them necessarily run during the build). The profiles can be inspected with `go tool pprof` from the command line or with _Run>Open Profiler Snapshot_ in IntelliJ IDEA. ### Kati Loading
ui/build/soong.go +6 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,12 @@ func primaryBuilderInvocation( 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{ Loading