@@ -38,23 +38,26 @@ private CSVFormat buildCsvFormat(String resultFilePath, int numberOfAllocations)
38
38
}
39
39
40
40
private String [] buildCsvHeaders (int numberOfAllocations ) {
41
- String [] csvHeaders = new String [(3 * numberOfAllocations ) +5 ];
41
+ String [] csvHeaders = new String [(3 * numberOfAllocations ) +8 ];
42
42
csvHeaders [0 ] = "Maven version" ;
43
43
csvHeaders [1 ] = "Average (bytes)" ;
44
44
csvHeaders [2 ] = "Average (Gb)" ;
45
45
csvHeaders [3 ] = "Min (bytes)" ;
46
46
csvHeaders [4 ] = "Max (bytes)" ;
47
+ csvHeaders [5 ] = "Average length(seconds)" ;
48
+ csvHeaders [6 ] = "Min length (seconds)" ;
49
+ csvHeaders [7 ] = "Max length (seconds)" ;
47
50
48
51
for (int i = 1 ; i < numberOfAllocations + 1 ; i ++) {
49
- csvHeaders [i + 4 ] = "Allocation" + " " + i + " " + "(bytes)" ;
52
+ csvHeaders [i + 7 ] = "Allocation" + " " + i + " " + "(bytes)" ;
50
53
}
51
54
52
55
for (int i = 1 ; i < numberOfAllocations + 1 ; i ++) {
53
- csvHeaders [i + 4 + numberOfAllocations ] = "Lenght" + " " + i + " " + "(seconds)" ;
56
+ csvHeaders [i + 7 + numberOfAllocations ] = "Lenght" + " " + i + " " + "(seconds)" ;
54
57
}
55
58
56
59
for (int i = 1 ; i < numberOfAllocations + 1 ; i ++) {
57
- csvHeaders [i + 4 + numberOfAllocations *2 ] = "Allocation" + " " + i + " " + "(Gb)" ;
60
+ csvHeaders [i + 7 + numberOfAllocations *2 ] = "Allocation" + " " + i + " " + "(Gb)" ;
58
61
}
59
62
return csvHeaders ;
60
63
}
@@ -72,6 +75,12 @@ private List<Object> buildCsvRecord(Maven3Version maven3Version, AllocationTimeP
72
75
csvRecord .add (allocationStatistics .getMin ());
73
76
csvRecord .add (allocationStatistics .getMax ());
74
77
78
+ LongSummaryStatistics lengthStatistics = Arrays .stream (input ).collect (Collectors .summarizingLong (AllocationTimePair ::getLenghtInSeconds ));
79
+ double averageAllocationInSeconds = lengthStatistics .getAverage ();
80
+ csvRecord .add (averageAllocationInSeconds );
81
+ csvRecord .add (lengthStatistics .getMin ());
82
+ csvRecord .add (lengthStatistics .getMax ());
83
+
75
84
for (int i = 0 ; i < input .length ; i ++) {
76
85
csvRecord .add (input [i ].getAllocationInBytes ());
77
86
}
@@ -83,6 +92,8 @@ private List<Object> buildCsvRecord(Maven3Version maven3Version, AllocationTimeP
83
92
for (int i = 0 ; i < input .length ; i ++) {
84
93
csvRecord .add (input [i ].getAllocationInBytes () / Math .pow (1024 , 3 ));
85
94
}
95
+
96
+
86
97
87
98
return csvRecord ;
88
99
}
0 commit comments