Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ private static long nextRandomSeed() {
this.opts = options;
this.status = status;
this.testName = this.getClass().getSimpleName();
everyN = (long) (opts.totalRows / (opts.totalRows * opts.sampleRate));
everyN = (long) (1 / opts.sampleRate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether (long) (1 / 1.0) will give us the correct result? Could it be 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, we don't have to worry about it because 1.0 (1 / 20) has a finite binary representation (unlike numbers like 0.1 or 0.2), so (1 / 1.0) will not yield any arithmetic error.

irb(main):001> [0].pack('G').bytes.map { "%08b" % it }.join
=> "0000000000000000000000000000000000000000000000000000000000000000"
irb(main):002> [1].pack('G').bytes.map { "%08b" % it }.join
=> "0011111111110000000000000000000000000000000000000000000000000000"
irb(main):003> [0.1].pack('G').bytes.map { "%08b" % it }.join
=> "0011111110111001100110011001100110011001100110011001100110011010"
irb(main):004> [0.2].pack('G').bytes.map { "%08b" % it }.join
=> "0011111111001001100110011001100110011001100110011001100110011010"

https://en.wikipedia.org/wiki/Double-precision_floating-point_format#Double-precision_examples

if (options.isValueZipf()) {
this.zipf = new RandomDistribution.Zipf(this.rand, 1, options.getValueSize(), 1.2);
}
Expand Down Expand Up @@ -2707,8 +2707,7 @@ protected static void printUsage(final String shortName, final String message) {
+ "Default: depend on oneCon parameter. if oneCon set to true, then connCount=1, "
+ "if not, connCount=thread number");

System.err.println(" sampleRate Execute test on a sample of total "
+ "rows. Only supported by randomRead. Default: 1.0");
System.err.println(" sampleRate Execute test on a sample of total rows. Default: 1.0");
System.err.println(" period Report every 'period' rows: "
+ "Default: opts.perClientRunRows / 10 = " + DEFAULT_OPTS.getPerClientRunRows() / 10);
System.err.println(" cycles How many times to cycle the test. Defaults: 1.");
Expand Down