aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/profiler/MetricData.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/profiler/MetricData.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/MetricData.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/MetricData.java b/src/main/java/com/google/devtools/build/lib/profiler/MetricData.java
index db46b0d866..419318c054 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/MetricData.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/MetricData.java
@@ -13,12 +13,10 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
+import static java.util.stream.Collectors.joining;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Range;
-
import java.text.DecimalFormat;
/**
@@ -33,14 +31,6 @@ public final class MetricData {
private final double avg;
private final double stdDev;
private final int max;
- private static final Predicate<HistogramElement> NON_EMPTY_HISTOGRAM_ELEMENT =
- new Predicate<HistogramElement>() {
- @Override
- public boolean apply(HistogramElement element) {
- return element.count > 0;
- }
- };
-
public MetricData(Object description, ImmutableList<HistogramElement> histogram, int count,
double avg, double stdDev, int max) {
this.description = description;
@@ -81,13 +71,23 @@ public final class MetricData {
return "'" + description + "'. Zero data recorded";
}
DecimalFormat fmt = new DecimalFormat("0.###");
- return "'" + description + "'. "
- + " Count: " + count
- + " Avg: " + fmt.format(avg)
- + " StdDev: " + fmt.format(stdDev)
- + " Max: " + max
+ return "'"
+ + description
+ + "'. "
+ + " Count: "
+ + count
+ + " Avg: "
+ + fmt.format(avg)
+ + " StdDev: "
+ + fmt.format(stdDev)
+ + " Max: "
+ + max
+ " Histogram:\n "
- + Joiner.on("\n ").join(Collections2.filter(histogram, NON_EMPTY_HISTOGRAM_ELEMENT));
+ + histogram
+ .stream()
+ .filter(element -> element.count > 0)
+ .map(Object::toString)
+ .collect(joining("\n "));
}
/** An histogram element that contains the range that applies to and the number of elements. */