@@ -112,6 +112,7 @@ private ByteArrayOutputStream start(ImmutableSet<ProfilerTask> tasks, Profiler.F
112
112
/* slimProfile= */ false ,
113
113
/* includePrimaryOutput= */ false ,
114
114
/* includeTargetLabel= */ false ,
115
+ /* includeConfiguration */ false ,
115
116
/* collectTaskHistograms= */ true ,
116
117
new CollectLocalResourceUsage (
117
118
BugReporter .defaultInstance (),
@@ -140,6 +141,7 @@ private void startUnbuffered(ImmutableSet<ProfilerTask> tasks) throws IOExceptio
140
141
/* slimProfile= */ false ,
141
142
/* includePrimaryOutput= */ false ,
142
143
/* includeTargetLabel= */ false ,
144
+ /* includeConfiguration */ false ,
143
145
/* collectTaskHistograms= */ true ,
144
146
new CollectLocalResourceUsage (
145
147
BugReporter .defaultInstance (),
@@ -253,6 +255,7 @@ public void testProfilerRecordingAllEvents() throws Exception {
253
255
/* slimProfile= */ false ,
254
256
/* includePrimaryOutput= */ false ,
255
257
/* includeTargetLabel= */ false ,
258
+ /* includeConfiguration */ false ,
256
259
/* collectTaskHistograms= */ true ,
257
260
new CollectLocalResourceUsage (
258
261
BugReporter .defaultInstance (),
@@ -339,6 +342,7 @@ public void testProfilerWorkerMetrics() throws Exception {
339
342
/* slimProfile= */ false ,
340
343
/* includePrimaryOutput= */ false ,
341
344
/* includeTargetLabel= */ false ,
345
+ /* includeConfiguration */ false ,
342
346
/* collectTaskHistograms= */ true ,
343
347
new CollectLocalResourceUsage (
344
348
BugReporter .defaultInstance (),
@@ -378,6 +382,7 @@ public void testProfilerRecordingOnlySlowestEvents() throws Exception {
378
382
/* slimProfile= */ false ,
379
383
/* includePrimaryOutput= */ false ,
380
384
/* includeTargetLabel= */ false ,
385
+ /* includeConfiguration */ false ,
381
386
/* collectTaskHistograms= */ true ,
382
387
new CollectLocalResourceUsage (
383
388
BugReporter .defaultInstance (),
@@ -511,6 +516,7 @@ public void testProfilerRecordsNothing() throws Exception {
511
516
/* slimProfile= */ false ,
512
517
/* includePrimaryOutput= */ false ,
513
518
/* includeTargetLabel= */ false ,
519
+ /* includeConfiguration */ false ,
514
520
/* collectTaskHistograms= */ true ,
515
521
new CollectLocalResourceUsage (
516
522
BugReporter .defaultInstance (),
@@ -717,6 +723,7 @@ public long nanoTime() {
717
723
/* slimProfile= */ false ,
718
724
/* includePrimaryOutput= */ false ,
719
725
/* includeTargetLabel= */ false ,
726
+ /* includeConfiguration */ false ,
720
727
/* collectTaskHistograms= */ true ,
721
728
new CollectLocalResourceUsage (
722
729
BugReporter .defaultInstance (),
@@ -771,6 +778,7 @@ public void write(int b) throws IOException {
771
778
/* slimProfile= */ false ,
772
779
/* includePrimaryOutput= */ false ,
773
780
/* includeTargetLabel= */ false ,
781
+ /* includeConfiguration */ false ,
774
782
/* collectTaskHistograms= */ true ,
775
783
new CollectLocalResourceUsage (
776
784
BugReporter .defaultInstance (),
@@ -810,6 +818,7 @@ public void write(int b) throws IOException {
810
818
/* slimProfile= */ false ,
811
819
/* includePrimaryOutput= */ false ,
812
820
/* includeTargetLabel= */ false ,
821
+ /* includeConfiguration */ false ,
813
822
/* collectTaskHistograms= */ true ,
814
823
new CollectLocalResourceUsage (
815
824
BugReporter .defaultInstance (),
@@ -844,6 +853,7 @@ public void testPrimaryOutputForAction() throws Exception {
844
853
/* slimProfile= */ false ,
845
854
/* includePrimaryOutput= */ true ,
846
855
/* includeTargetLabel= */ false ,
856
+ /* includeConfiguration */ false ,
847
857
/* collectTaskHistograms= */ true ,
848
858
new CollectLocalResourceUsage (
849
859
BugReporter .defaultInstance (),
@@ -856,7 +866,14 @@ public void testPrimaryOutputForAction() throws Exception {
856
866
/* collectResourceManagerEstimation= */ false ,
857
867
/* collectPressureStallIndicators= */ false ,
858
868
/* collectSkyframeCounts= */ false ));
859
- try (SilentCloseable c = profiler .profileAction (ProfilerTask .ACTION , "test" , "foo.out" , "" )) {
869
+ try (SilentCloseable c =
870
+ profiler .profileAction (
871
+ ProfilerTask .ACTION , /* mnemonic */
872
+ null ,
873
+ "test" ,
874
+ "foo.out" ,
875
+ "" , /* configuration */
876
+ null )) {
860
877
profiler .logEvent (ProfilerTask .PHASE , "event1" );
861
878
}
862
879
profiler .stop ();
@@ -886,6 +903,7 @@ public void testTargetLabelForAction() throws Exception {
886
903
/* slimProfile= */ false ,
887
904
/* includePrimaryOutput= */ false ,
888
905
/* includeTargetLabel= */ true ,
906
+ /* includeConfiguration */ false ,
889
907
/* collectTaskHistograms= */ true ,
890
908
new CollectLocalResourceUsage (
891
909
BugReporter .defaultInstance (),
@@ -899,7 +917,13 @@ public void testTargetLabelForAction() throws Exception {
899
917
/* collectPressureStallIndicators= */ false ,
900
918
/* collectSkyframeCounts= */ false ));
901
919
try (SilentCloseable c =
902
- profiler .profileAction (ProfilerTask .ACTION , "test" , "foo.out" , "//foo:bar" )) {
920
+ profiler .profileAction (
921
+ ProfilerTask .ACTION , /* mnemonic */
922
+ null ,
923
+ "test" ,
924
+ "foo.out" ,
925
+ "//foo:bar" , /* configuration */
926
+ null )) {
903
927
profiler .logEvent (ProfilerTask .PHASE , "event1" );
904
928
}
905
929
profiler .stop ();
@@ -913,6 +937,51 @@ public void testTargetLabelForAction() throws Exception {
913
937
.hasSize (1 );
914
938
}
915
939
940
+ @ Test
941
+ public void testTargetConfigurationForAction () throws Exception {
942
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream ();
943
+
944
+ profiler .start (
945
+ getAllProfilerTasks (),
946
+ buffer ,
947
+ JSON_TRACE_FILE_FORMAT ,
948
+ "dummy_output_base" ,
949
+ UUID .randomUUID (),
950
+ true ,
951
+ clock ,
952
+ clock .nanoTime (),
953
+ /* slimProfile= */ false ,
954
+ /* includePrimaryOutput= */ false ,
955
+ /* includeTargetLabel= */ false ,
956
+ /* includeConfiguration */ true ,
957
+ /* collectTaskHistograms= */ true ,
958
+ new CollectLocalResourceUsage (
959
+ BugReporter .defaultInstance (),
960
+ WorkerProcessMetricsCollector .instance (),
961
+ ResourceManager .instance (),
962
+ InMemoryGraph .create (),
963
+ /* collectWorkerDataInProfiler= */ false ,
964
+ /* collectLoadAverage= */ false ,
965
+ /* collectSystemNetworkUsage= */ false ,
966
+ /* collectResourceManagerEstimation= */ false ,
967
+ /* collectPressureStallIndicators= */ false ,
968
+ /* collectSkyframeCounts= */ false ));
969
+ try (SilentCloseable c =
970
+ profiler .profileAction (
971
+ ProfilerTask .ACTION , /* mnemonic */ null , "test" , "foo.out" , "//foo:bar" , "012345" )) {
972
+ profiler .logEvent (ProfilerTask .PHASE , "event1" );
973
+ }
974
+ profiler .stop ();
975
+
976
+ JsonProfile jsonProfile = new JsonProfile (new ByteArrayInputStream (buffer .toByteArray ()));
977
+
978
+ assertThat (
979
+ jsonProfile .getTraceEvents ().stream ()
980
+ .filter (traceEvent -> "012345" .equals (traceEvent .configuration ()))
981
+ .collect (Collectors .toList ()))
982
+ .hasSize (1 );
983
+ }
984
+
916
985
private ByteArrayOutputStream getJsonProfileOutputStream (boolean slimProfile ) throws IOException {
917
986
ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
918
987
profiler .start (
@@ -927,6 +996,7 @@ private ByteArrayOutputStream getJsonProfileOutputStream(boolean slimProfile) th
927
996
slimProfile ,
928
997
/* includePrimaryOutput= */ false ,
929
998
/* includeTargetLabel= */ false ,
999
+ /* includeConfiguration */ false ,
930
1000
/* collectTaskHistograms= */ true ,
931
1001
new CollectLocalResourceUsage (
932
1002
BugReporter .defaultInstance (),
@@ -977,11 +1047,18 @@ public void testSlimProfileSize() throws Exception {
977
1047
public void testProfileMnemonicIncluded () throws Exception {
978
1048
ByteArrayOutputStream buffer = start (getAllProfilerTasks (), JSON_TRACE_FILE_FORMAT );
979
1049
try (SilentCloseable c =
980
- profiler .profileAction (ProfilerTask .ACTION , "without mnemonic" , "" , "" )) {
1050
+ profiler .profileAction (
1051
+ ProfilerTask .ACTION , /* mnemonic */
1052
+ null ,
1053
+ "without mnemonic" ,
1054
+ "" ,
1055
+ "" , /* configuration */
1056
+ null )) {
981
1057
clock .advanceMillis (100 );
982
1058
}
983
1059
try (SilentCloseable c =
984
- profiler .profileAction (ProfilerTask .ACTION , "foo" , "with mnemonic" , "" , "" )) {
1060
+ profiler .profileAction (
1061
+ ProfilerTask .ACTION , "foo" , "with mnemonic" , "" , "" , /* configuration */ null )) {
985
1062
clock .advanceMillis (100 );
986
1063
}
987
1064
profiler .stop ();
@@ -1024,10 +1101,29 @@ public void testActionCacheHitsCounted() throws Exception {
1024
1101
// The setup here is one action and one action check taking 200ms (the bucket duration),
1025
1102
// another action check for 300ms, so spilling over in the next bucket.
1026
1103
try (SilentCloseable c =
1027
- profiler .profileAction (ProfilerTask .ACTION_CHECK , "bar action" , "with mnemonic" , "" , "" )) {
1028
- try (SilentCloseable c2 = profiler .profileAction (ProfilerTask .ACTION , "foo action" , "" , "" );
1104
+ profiler .profileAction (
1105
+ ProfilerTask .ACTION_CHECK ,
1106
+ "bar action" ,
1107
+ "with mnemonic" ,
1108
+ "" ,
1109
+ "" , /* configuration */
1110
+ null )) {
1111
+ try (SilentCloseable c2 =
1112
+ profiler .profileAction (
1113
+ ProfilerTask .ACTION , /* mnemonic */
1114
+ null ,
1115
+ "foo action" ,
1116
+ "" ,
1117
+ "" , /* configuration */
1118
+ null );
1029
1119
SilentCloseable c3 =
1030
- profiler .profileAction (ProfilerTask .ACTION_CHECK , "bar action" , "" , "" )) {
1120
+ profiler .profileAction (
1121
+ ProfilerTask .ACTION_CHECK , /* mnemonic */
1122
+ null ,
1123
+ "bar action" ,
1124
+ "" ,
1125
+ "" , /* configuration */
1126
+ null )) {
1031
1127
clock .advanceMillis (200 );
1032
1128
}
1033
1129
clock .advanceMillis (100 );
0 commit comments