diff --git a/core/src/main/java/com/yahoo/ycsb/measurements/Measurements.java b/core/src/main/java/com/yahoo/ycsb/measurements/Measurements.java index 6c84f80a1a00e0e1b0a176b6f2d0d49488bb6b7d..f1d7bbe5dbeb3839ebefaca859987a8ad7c70763 100644 --- a/core/src/main/java/com/yahoo/ycsb/measurements/Measurements.java +++ b/core/src/main/java/com/yahoo/ycsb/measurements/Measurements.java @@ -38,6 +38,7 @@ public class Measurements { HISTOGRAM, HDRHISTOGRAM, HDRHISTOGRAM_AND_HISTOGRAM, + HDRHISTOGRAM_AND_RAW, TIMESERIES, RAW } @@ -97,6 +98,10 @@ public class Measurements { { _measurementType = MeasurementType.HDRHISTOGRAM_AND_HISTOGRAM; } + else if (mTypeString.equals("hdrhistogram+raw")) + { + _measurementType = MeasurementType.HDRHISTOGRAM_AND_RAW; + } else if (mTypeString.equals("timeseries")) { _measurementType = MeasurementType.TIMESERIES; @@ -139,6 +144,10 @@ public class Measurements { return new TwoInOneMeasurement(name, new OneMeasurementHdrHistogram("Hdr"+name, _props), new OneMeasurementHistogram("Bucket"+name, _props)); + case HDRHISTOGRAM_AND_RAW: + return new TwoInOneMeasurement(name, + new OneMeasurementHdrHistogram("Hdr"+name, _props), + new OneMeasurementHistogram("Raw"+name, _props)); case TIMESERIES: return new OneMeasurementTimeSeries(name, _props); case RAW: diff --git a/core/src/main/java/com/yahoo/ycsb/measurements/OneMeasurementRaw.java b/core/src/main/java/com/yahoo/ycsb/measurements/OneMeasurementRaw.java index b401b42f083760188a18228f67f6a3e67ffc254b..132952d90b1a23767b3e6feb961773a1400c72ac 100644 --- a/core/src/main/java/com/yahoo/ycsb/measurements/OneMeasurementRaw.java +++ b/core/src/main/java/com/yahoo/ycsb/measurements/OneMeasurementRaw.java @@ -22,7 +22,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Properties; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.Collections; import java.util.Comparator; import com.yahoo.ycsb.measurements.exporter.MeasurementsExporter; @@ -77,14 +77,28 @@ public class OneMeasurementRaw extends OneMeasurement { */ public static final String OUTPUT_FILE_PATH = "measurement.raw.output_file"; public static final String OUTPUT_FILE_PATH_DEFAULT = ""; + + /** + * Optionally, user can request to not output summary stats. This is useful + * if the user chains the raw measurement type behind the HdrHistogram type + * which already outputs summary stats. But even in that case, the user may + * still want this class to compute summary stats for them, especially if + * they want accurate computation of percentiles (because percentils computed + * by histogram classes are still approximations). + */ + public static final String NO_SUMMARY_STATS = "measurement.raw.no_summary"; + public static final String NO_SUMMARY_STATS_DEFAULT = "false"; + private String outputFilePath = ""; private final PrintStream outputStream; - private ArrayList<RawDataPoint> measurements; + private boolean noSummaryStats = false; + + private LinkedList<RawDataPoint> measurements; private long totalLatency = 0; // A window of stats to print summary for at the next getSummary() call. - // It's supposed to be a one line summary, so we will just print count and + // It's supposed to be a one line summary, so we will just print count and // average. private int windowOperations = 0; private long windowTotalLatency = 0; @@ -111,7 +125,11 @@ public class OneMeasurementRaw extends OneMeasurement { outputStream = System.out; } - measurements = new ArrayList<RawDataPoint>(1000); + + noSummaryStats = Boolean.parseBoolean(props.getProperty(NO_SUMMARY_STATS, + NO_SUMMARY_STATS_DEFAULT)); + + measurements = new LinkedList<RawDataPoint>(); } @Override @@ -142,7 +160,7 @@ public class OneMeasurementRaw extends OneMeasurement { int totalOps = measurements.size(); exporter.write(getName(), "Total Operations", totalOps); - if (totalOps > 0) { + if (totalOps > 0 && !noSummaryStats) { exporter.write(getName(), "Below is a summary of latency in microseconds:", -1); exporter.write(getName(), "Average", diff --git a/workloads/workload_template b/workloads/workload_template index f95d1d4804e0aeb08bf1c300033cbbc6a9bb3f9d..6aebd64a178d525032214076a2e7c2d15b104485 100644 --- a/workloads/workload_template +++ b/workloads/workload_template @@ -121,11 +121,11 @@ measurementtype=histogram # "operation, timestamp of the measurement, latency in us" # # Raw datapoints are collected in-memory while the test is running. Each -# data point consumes about 20 bytes (including java object overhead). +# data point consumes about 50 bytes (including java object overhead). # For a typical run of 1 million to 10 million operations, this should -# easily fit into memory. If you plan to do a run with 100s of millions of -# operations, consider increasing your jvm heap size before you enable the -# RAW measurement type, or split the run into multiple runs. +# fit into memory most of the time. If you plan to do 100s of millions of +# operations per run, consider provisioning a machine with larger RAM when using +# the RAW measurement type, or split the run into multiple runs. # # Optionally, you can specify an output file to save raw datapoints. # Otherwise, raw datapoints will be written to stdout.