make --hdr_digits configurable

This commit is contained in:
Jonathan Shook 2020-05-20 11:18:30 -05:00
parent a63ab7dff6
commit 548b3a4e83
4 changed files with 35 additions and 3 deletions

View File

@ -18,6 +18,7 @@
package io.nosqlbench.engine.api.metrics;
import com.codahale.metrics.*;
import io.nosqlbench.engine.api.activityapi.core.Activity;
import io.nosqlbench.engine.api.activityapi.core.MetricRegistryService;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.util.Unit;
@ -43,6 +44,16 @@ public class ActivityMetrics {
};
private static List<MetricsCloseable> metricsCloseables = new ArrayList<>();
private static int significantDigits = 4;
public static int getSignificantDigits() {
return significantDigits;
}
public static void setHdrDigits(int hdrDigits) {
ActivityMetrics.significantDigits = hdrDigits;
}
private ActivityMetrics() {
}
@ -98,7 +109,7 @@ public class ActivityMetrics {
public static Timer timer(ActivityDef activityDef, String name) {
String fullMetricName = activityDef.getAlias() + "." + name;
Timer registeredTimer = (Timer) register(activityDef, name, () ->
new NicerTimer(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, 4)));
new NicerTimer(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, significantDigits)));
return registeredTimer;
}
@ -114,7 +125,7 @@ public class ActivityMetrics {
public static Histogram histogram(ActivityDef activityDef, String name) {
String fullMetricName = activityDef.getAlias() + "." + name;
return (Histogram) register(activityDef, name, () ->
new NicerHistogram(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, 4)));
new NicerHistogram(fullMetricName, new DeltaHdrHistogramReservoir(fullMetricName, significantDigits)));
}
/**

View File

@ -81,6 +81,8 @@ public class NBCLI {
ConsoleLogging.enableConsoleLogging(options.wantsConsoleLogLevel(), options.getConsoleLoggingPattern());
ActivityMetrics.setHdrDigits(options.getHdrDigits());
if (options.wantsBasicHelp()) {
System.out.println(loadHelpFile("basic.md"));
System.exit(0);

View File

@ -53,6 +53,7 @@ public class NBCLIOptions {
private static final String WAIT_MILLIS = "waitmillis";
private static final String EXPORT_CYCLE_LOG = "--export-cycle-log";
private static final String IMPORT_CYCLE_LOG = "--import-cycle-log";
private static final String HDR_DIGITS = "--hdr-digits";
// Execution Options
@ -127,7 +128,7 @@ public class NBCLIOptions {
private final List<String> wantsToIncludePaths = new ArrayList<>();
private Scenario.Engine engine = Scenario.Engine.Graalvm;
private boolean graaljs_compat = false;
private int hdr_digits = 4;
public NBCLIOptions(String[] args) {
parse(args);
@ -213,6 +214,10 @@ public class NBCLIOptions {
arglist.removeFirst();
logsDirectory = readWordOrThrow(arglist, "a log directory");
break;
case HDR_DIGITS:
arglist.removeFirst();
hdr_digits = Integer.parseInt(readWordOrThrow(arglist, "significant digits"));
break;
case LOGS_MAX:
arglist.removeFirst();
logsMax = Integer.parseInt(readWordOrThrow(arglist, "max logfiles to keep"));
@ -531,6 +536,10 @@ public class NBCLIOptions {
// }
public int getHdrDigits() {
return hdr_digits;
}
public String getProgressSpec() {
ProgressSpec spec = parseProgressSpec(this.progressSpec);// sanity check
if (spec.indicatorMode == IndicatorMode.console

View File

@ -153,6 +153,16 @@ created for this name.
--session-name <name>
If you want to control the number of significant digits in all of the HDR metrics, including histograms and timers, then
you can do so this way:
--hdr-digits 4
The default is 4 digits, which creates 10000 equisized histogram buckets for every named metric in every reporting
interval. For longer running test or for test which do not require this level of precision in metrics, you can set this
down to 3 or 2.
Enlist engineblock to stand up your metrics infrastructure using a local docker runtime:
--docker-metrics