Add option to disable critical path computation in Bazel. While this information is useful, the critical path computer retains references to objects that could otherwise be cleared to save memory.
This change is probably not worth submitting on its own -- the benefit it provides is too slight. But my follow-up change unknown commit needs this option to be effective -- the critical path currently hangs on to references to every action in the graph, so we can't drop references to actions if it's enabled.
The critical path could probably be reworked in the future to not hang onto those references.
PiperOrigin-RevId: 151747605
diff --git a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
index 7766b6c..c2b40c0 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
@@ -218,4 +218,16 @@
+ "number of file digests to be cached."
)
public long cacheSizeForComputedFileDigests;
+
+
+ @Option(
+ name = "experimental_enable_critical_path_profiling",
+ defaultValue = "true",
+ category = "undocumented",
+ help =
+ "If set (the default), critical path profiling is enabled for the execution phase. "
+ + "This has a slight overhead in RAM and CPU, and may prevent Bazel from making certain"
+ + " aggressive RAM optimizations in some cases."
+ )
+ public boolean enableCriticalPathProfiling;
}