private static DescriptiveStatistics sanitize(@NotNull DescriptiveStatistics data) {
    double meanValue = data.getMean();
    double delta = MARGIN * meanValue;
    double minVal = meanValue - delta;
    double maxVal = meanValue + delta;
    return new DescriptiveStatistics(Arrays.stream(data.getValues())
        .filter(x -> x > minVal && x < maxVal)
        .toArray());
  }
Get new statistics that excludes values beyond mean +/- 2 * stdev

@param data Source data
@return new {@link @DescriptiveStatistics objects with sanitized data}
standalone-metastore/metastore-tools/tools-common/src/main/java/org/apache/hadoop/hive/metastore/tools/BenchmarkSuite.java