Add option to slim down the JSON profile.

If the JSON profile contains many events, we will start merging short events that are close to each other on the same thread.
The event count threshold is chosen high enough to show all data for small clean builds and incremental builds.

With this profile thinning, profiles for big builds that did crash chrome://tracing before, do now load. By keeping all events that are not short we still see all interesting data.

RELNOTES: None
PiperOrigin-RevId: 239609724
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index 9452400..0a1dccf 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -233,6 +233,16 @@
   public List<ProfilerTask> additionalProfileTasks;
 
   @Option(
+      name = "experimental_slim_json_profile",
+      defaultValue = "false",
+      documentationCategory = OptionDocumentationCategory.LOGGING,
+      effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
+      help =
+          "Slims down the size of the JSON profile by merging events if the profile gets "
+              + " too large.")
+  public boolean enableJsonProfileDiet;
+
+  @Option(
       name = "profile",
       defaultValue = "null",
       documentationCategory = OptionDocumentationCategory.LOGGING,