Add better instrumentation to the InfoCommand.
RELNOTES: None
Closes
@@ -22,6 +22,8 @@ import com.google.devtools.build.lib.analysis.NoBuildEvent;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
import com.google.devtools.build.lib.events.Event;
+import com.google.devtools.build.lib.profiler.Profiler;
+import com.google.devtools.build.lib.profiler.SilentCloseable;
import com.google.devtools.build.lib.runtime.BlazeCommand;
import com.google.devtools.build.lib.runtime.BlazeCommandResult;
import com.google.devtools.build.lib.runtime.BlazeRuntime;
@@ -153,7 +155,7 @@ public class InfoCommand implements BlazeCommand {
Supplier<BuildConfiguration> configurationSupplier =
Suppliers.memoize(
() -> {
- try {
+ try (SilentCloseable c = Profiler.instance().profile("Creating BuildConfiguration")) {
// In order to be able to answer configuration-specific queries, we need to set up
// the package path. Since info inherits all the build options, all the necessary
// information is available here.
@@ -251,9 +253,11 @@ public class InfoCommand implements BlazeCommand {
}
outErr.getOutputStream().write(
(infoItem.getName() + ": ").getBytes(StandardCharsets.UTF_8));
+ try (SilentCloseable c = Profiler.instance().profile(infoItem.getName() + ".infoItem")) {
outErr.getOutputStream().write(infoItem.get(configurationSupplier, env));
}
}
+ }
} catch (AbruptExitException e) {
return BlazeCommandResult.detailedExitCode(e.getDetailedExitCode());
} catch (AbruptExitRuntimeException e) {
