[Profiler] Add target label of action owner to profiler trace files
While analyzing trace files, it is useful to have target label associated with the action which was created by that target. This change adds target label under trace events which have owner, mostly Action-type event. Target label is saved as a custom entry to "args" map attached to each Action event, as per trace format definition.
The change is guarded by new flag `--experimental_profile_include_target_label`
Closes #11443.
PiperOrigin-RevId: 314687980
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 e1ae2a7..765a4f5 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
@@ -289,6 +289,14 @@
public boolean includePrimaryOutput;
@Option(
+ name = "experimental_profile_include_target_label",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.LOGGING,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.BAZEL_MONITORING},
+ help = "Includes target label in action events' JSON profile data.")
+ public boolean profileIncludeTargetLabel;
+
+ @Option(
name = "experimental_announce_profile_path",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.LOGGING,