mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
change tests System.out calls to use logger directly
This commit is contained in:
parent
4f4b4982c8
commit
6c8782842d
@ -19,7 +19,7 @@ package io.nosqlbench.engine.api.activityimpl.uniform.flowtypes;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <H2>ChainingOp<I,O>: f(I) -> O</I,O></H2>
|
* <H2>ChainingOp<I,O>: f(I) -> O<I,O></H2>
|
||||||
* <P>
|
* <P>
|
||||||
* Run a function on the current cached result in the current thread and replace it
|
* Run a function on the current cached result in the current thread and replace it
|
||||||
* with the result of the function. ChainingOps are one way of invoking
|
* with the result of the function. ChainingOps are one way of invoking
|
||||||
|
@ -18,12 +18,15 @@ package io.nosqlbench.engine.api.activityimpl.tracking;
|
|||||||
|
|
||||||
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTracker;
|
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTracker;
|
||||||
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTrackerAtomic;
|
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTrackerAtomic;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class LongTreeTrackerTest2 {
|
public class LongTreeTrackerTest2 {
|
||||||
|
private final static Logger logger = LogManager.getLogger(LongTreeTrackerTest2.class);
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
// public void testCoMask() {
|
// public void testCoMask() {
|
||||||
@ -96,21 +99,21 @@ public class LongTreeTrackerTest2 {
|
|||||||
public void testApply() {
|
public void testApply() {
|
||||||
LongTreeTracker t = new LongTreeTracker(0L);
|
LongTreeTracker t = new LongTreeTracker(0L);
|
||||||
t.setCompleted(0);
|
t.setCompleted(0);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(1);
|
t.setCompleted(1);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(2);
|
t.setCompleted(2);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(5);
|
t.setCompleted(5);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(6);
|
t.setCompleted(6);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(3);
|
t.setCompleted(3);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(4);
|
t.setCompleted(4);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
t.setCompleted(7);
|
t.setCompleted(7);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -119,7 +122,7 @@ public class LongTreeTrackerTest2 {
|
|||||||
for (int i = 0; i < 32 ; i++) {
|
for (int i = 0; i < 32 ; i++) {
|
||||||
t.setCompleted(i);
|
t.setCompleted(i);
|
||||||
}
|
}
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
assertThat(t.getImage()).isEqualTo(-2L);
|
assertThat(t.getImage()).isEqualTo(-2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +144,7 @@ public class LongTreeTrackerTest2 {
|
|||||||
@Test
|
@Test
|
||||||
public void testBitString() {
|
public void testBitString() {
|
||||||
LongTreeTracker t = new LongTreeTracker(2L);
|
LongTreeTracker t = new LongTreeTracker(2L);
|
||||||
System.out.println(t);
|
logger.debug(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,8 @@ import com.google.gson.GsonBuilder;
|
|||||||
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
||||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
||||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -28,6 +30,7 @@ import java.util.Map;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class CommandTemplateTest {
|
public class CommandTemplateTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(CommandTemplateTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCommandTemplate() {
|
public void testCommandTemplate() {
|
||||||
@ -53,7 +56,7 @@ public class CommandTemplateTest {
|
|||||||
OpTemplate optpl = stmtsDocs.getStmts().get(0);
|
OpTemplate optpl = stmtsDocs.getStmts().get(0);
|
||||||
CommandTemplate ct = new CommandTemplate(optpl);
|
CommandTemplate ct = new CommandTemplate(optpl);
|
||||||
String format = gson.toJson(ct);
|
String format = gson.toJson(ct);
|
||||||
System.out.println(format);
|
logger.debug(format);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ package io.nosqlbench.nb;
|
|||||||
|
|
||||||
import org.HdrHistogram.DoubleHistogram;
|
import org.HdrHistogram.DoubleHistogram;
|
||||||
import org.HdrHistogram.DoubleRecorder;
|
import org.HdrHistogram.DoubleRecorder;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.DoubleSummaryStatistics;
|
import java.util.DoubleSummaryStatistics;
|
||||||
@ -31,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* a proof, so we can get on with testing!
|
* a proof, so we can get on with testing!
|
||||||
*/
|
*/
|
||||||
public class AggregateTests {
|
public class AggregateTests {
|
||||||
|
private final static Logger logger = LogManager.getLogger(AggregateTests.class);
|
||||||
double[][] data = new double[][]{
|
double[][] data = new double[][]{
|
||||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 91},
|
{1, 1, 1, 1, 1, 1, 1, 1, 1, 91},
|
||||||
{15, 15, 15, 15, 15, 5, 5, 5, 5, 5},
|
{15, 15, 15, 15, 15, 5, 5, 5, 5, 5},
|
||||||
@ -62,8 +65,8 @@ public class AggregateTests {
|
|||||||
aggstats.accept(series.getAverage());
|
aggstats.accept(series.getAverage());
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("aggstats avg:" + aggstats.getAverage());
|
logger.debug("aggstats avg:" + aggstats.getAverage());
|
||||||
System.out.println("allstats avg:" + allstats.getAverage());
|
logger.debug("allstats avg:" + allstats.getAverage());
|
||||||
|
|
||||||
assertThat(aggstats.getAverage()).isNotEqualTo(allstats.getAverage());
|
assertThat(aggstats.getAverage()).isNotEqualTo(allstats.getAverage());
|
||||||
}
|
}
|
||||||
@ -92,21 +95,21 @@ public class AggregateTests {
|
|||||||
all.recordValue(v);
|
all.recordValue(v);
|
||||||
}
|
}
|
||||||
snapshots[i]=recorder.getIntervalHistogram();
|
snapshots[i]=recorder.getIntervalHistogram();
|
||||||
System.out.println(snapshot(snapshots[i],"ary[" + i + "]"));
|
logger.debug(snapshot(snapshots[i],"ary[" + i + "]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleHistogram histoall = all.getIntervalHistogram();
|
DoubleHistogram histoall = all.getIntervalHistogram();
|
||||||
System.out.println(snapshot(histoall, "all"));
|
logger.debug(snapshot(histoall, "all"));
|
||||||
|
|
||||||
for (double pctile : new double[]{10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 99.9, 99.99}) {
|
for (double pctile : new double[]{10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 99.9, 99.99}) {
|
||||||
DoubleSummaryStatistics avgOfInputs = new DoubleSummaryStatistics();
|
DoubleSummaryStatistics avgOfInputs = new DoubleSummaryStatistics();
|
||||||
for (DoubleHistogram snapshot : snapshots) {
|
for (DoubleHistogram snapshot : snapshots) {
|
||||||
avgOfInputs.accept(snapshot.getValueAtPercentile(pctile));
|
avgOfInputs.accept(snapshot.getValueAtPercentile(pctile));
|
||||||
}
|
}
|
||||||
System.out.println("avg of " + pctile + " => " + String.format("%.3f",avgOfInputs.getAverage()) + " (min,max)=("+String.format("%.3f",avgOfInputs.getMin()) + "," +
|
logger.debug("avg of " + pctile + " => " + String.format("%.3f",avgOfInputs.getAverage()) + " (min,max)=("+String.format("%.3f",avgOfInputs.getMin()) + "," +
|
||||||
String.format("%.3f",avgOfInputs.getMax())+ ")");
|
String.format("%.3f",avgOfInputs.getMax())+ ")");
|
||||||
System.out.println("direct " + pctile + " => " + String.format("%.3f",histoall.getValueAtPercentile(pctile)));
|
logger.debug("direct " + pctile + " => " + String.format("%.3f",histoall.getValueAtPercentile(pctile)));
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +131,10 @@ public class AggregateTests {
|
|||||||
prototype[j]=r.nextDouble()*100;
|
prototype[j]=r.nextDouble()*100;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.print("proto[" + i + "] = ");
|
logger.debug("proto[" + i + "] = ");
|
||||||
for (double v : prototype) {
|
for (double v : prototype) {
|
||||||
System.out.print(String.format("% 3.0f ",v));
|
logger.trace(String.format("% 3.0f ",v));
|
||||||
}
|
}
|
||||||
System.out.println();
|
|
||||||
series[i]=resampleCurve(prototype,100);
|
series[i]=resampleCurve(prototype,100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ import org.apache.commons.math3.optim.*;
|
|||||||
import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
|
import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
|
||||||
import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
|
import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
|
||||||
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer;
|
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -52,6 +54,7 @@ import java.util.Random;
|
|||||||
*/
|
*/
|
||||||
public class TestOptimoExperiments {
|
public class TestOptimoExperiments {
|
||||||
|
|
||||||
|
private final static Logger logger = LogManager.getLogger(TestOptimoExperiments.class);
|
||||||
@Test
|
@Test
|
||||||
public void testNewAlgo() {
|
public void testNewAlgo() {
|
||||||
|
|
||||||
@ -81,7 +84,7 @@ public class TestOptimoExperiments {
|
|||||||
);
|
);
|
||||||
PointValuePair result = mo.optimize(od.toArray(new OptimizationData[0]));
|
PointValuePair result = mo.optimize(od.toArray(new OptimizationData[0]));
|
||||||
|
|
||||||
System.out.println(
|
logger.debug(
|
||||||
"point:" + Arrays.toString(result.getPoint()) +
|
"point:" + Arrays.toString(result.getPoint()) +
|
||||||
" value=" + m.value(result.getPoint())
|
" value=" + m.value(result.getPoint())
|
||||||
);
|
);
|
||||||
|
@ -27,6 +27,8 @@ import io.swagger.v3.oas.models.PathItem;
|
|||||||
import io.swagger.v3.oas.models.Paths;
|
import io.swagger.v3.oas.models.Paths;
|
||||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||||
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.introspector.BeanAccess;
|
import org.yaml.snakeyaml.introspector.BeanAccess;
|
||||||
@ -39,6 +41,7 @@ import java.util.stream.Collectors;
|
|||||||
* .md#securityRequirementObject">OpenApi Spec 3.1.0</A>
|
* .md#securityRequirementObject">OpenApi Spec 3.1.0</A>
|
||||||
*/
|
*/
|
||||||
public class OpenApiLoader {
|
public class OpenApiLoader {
|
||||||
|
private final static Logger logger = LogManager.getLogger(OpenApiLoader.class);
|
||||||
|
|
||||||
private static final OpenAPIParser parser = new OpenAPIParser();
|
private static final OpenAPIParser parser = new OpenAPIParser();
|
||||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
@ -91,7 +94,7 @@ public class OpenApiLoader {
|
|||||||
yaml.setBeanAccess(BeanAccess.DEFAULT);
|
yaml.setBeanAccess(BeanAccess.DEFAULT);
|
||||||
|
|
||||||
for (PathOp activeOp : activeOps) {
|
for (PathOp activeOp : activeOps) {
|
||||||
System.out.println("yaml for op:" + yaml.dump(activeOp));
|
logger.debug("yaml for op:" + yaml.dump(activeOp));
|
||||||
pathops.put(activeOp.getCall(), activeOp);
|
pathops.put(activeOp.getCall(), activeOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
package io.nosqlbench.engine.rest.services.openapi;
|
package io.nosqlbench.engine.rest.services.openapi;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class OpenApiLoaderTest {
|
public class OpenApiLoaderTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(OpenApiLoaderTest.class);
|
||||||
@Test
|
@Test
|
||||||
public void testYamlGenerator() {
|
public void testYamlGenerator() {
|
||||||
String openidpath = "stargate.yaml";
|
String openidpath = "stargate.yaml";
|
||||||
@ -28,7 +30,7 @@ public class OpenApiLoaderTest {
|
|||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
String result = OpenApiLoader.generateWorkloadFromFilepath(openidpath, filterJson);
|
String result = OpenApiLoader.generateWorkloadFromFilepath(openidpath, filterJson);
|
||||||
System.out.println(result);
|
logger.debug(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class TriangularStepTest {
|
|||||||
public void testStepExample1() {
|
public void testStepExample1() {
|
||||||
TriangularStep e1 = new TriangularStep(100, 20);
|
TriangularStep e1 = new TriangularStep(100, 20);
|
||||||
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
||||||
System.out.println(Arrays.toString(runLengths));
|
// System.out.println(Arrays.toString(runLengths));
|
||||||
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(80L);
|
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(80L);
|
||||||
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(120L);
|
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(120L);
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class TriangularStepTest {
|
|||||||
public void testStepExample2() {
|
public void testStepExample2() {
|
||||||
TriangularStep e1 = new TriangularStep(80, 10);
|
TriangularStep e1 = new TriangularStep(80, 10);
|
||||||
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
||||||
System.out.println(Arrays.toString(runLengths));
|
// System.out.println(Arrays.toString(runLengths));
|
||||||
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(70L);
|
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(70L);
|
||||||
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(90L);
|
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(90L);
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class TriangularStepTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int count : counts) {
|
for (int count : counts) {
|
||||||
System.out.println(count);
|
// System.out.println(count);
|
||||||
histo[count-minval][FREQUENCY]++;
|
histo[count-minval][FREQUENCY]++;
|
||||||
}
|
}
|
||||||
return histo;
|
return histo;
|
||||||
|
@ -17,11 +17,14 @@
|
|||||||
package io.nosqlbench.virtdata.library.basics.tests.long_long;
|
package io.nosqlbench.virtdata.library.basics.tests.long_long;
|
||||||
|
|
||||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.SignedHash;
|
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.SignedHash;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class SignedHashTest {
|
public class SignedHashTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(SignedHashTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFunctionalResult() {
|
public void testFunctionalResult() {
|
||||||
@ -44,12 +47,13 @@ public class SignedHashTest {
|
|||||||
SignedHash hash = new SignedHash();
|
SignedHash hash = new SignedHash();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
long l = hash.applyAsLong(i) % 50L;
|
long l = hash.applyAsLong(i) % 50L;
|
||||||
System.out.println("i=" + i + " result=" + l);
|
logger.debug("i=" + i + " result=" + l);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
long l = hash.applyAsLong(i+1000000L) % 50L;
|
long l = hash.applyAsLong(i+1000000L) % 50L;
|
||||||
System.out.println("i=" + i + " result=" + l);
|
logger.debug("i=" + i + " result=" + l);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,15 @@
|
|||||||
package io.nosqlbench.virtdata.library.basics.tests.long_string;
|
package io.nosqlbench.virtdata.library.basics.tests.long_string;
|
||||||
|
|
||||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Combinations;
|
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Combinations;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||||
|
|
||||||
public class CombinationsTest {
|
public class CombinationsTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(CombinationsTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimplePrimes() {
|
public void testSimplePrimes() {
|
||||||
@ -38,7 +41,7 @@ public class CombinationsTest {
|
|||||||
Combinations binaryByte = new Combinations("0-1;0-1;0-1;0-1;0-1;0-1;0-1;0-1;");
|
Combinations binaryByte = new Combinations("0-1;0-1;0-1;0-1;0-1;0-1;0-1;0-1;");
|
||||||
assertThat(binaryByte.apply(37)).isEqualTo("00100101");
|
assertThat(binaryByte.apply(37)).isEqualTo("00100101");
|
||||||
for (int i = 0; i < 512; i++) {
|
for (int i = 0; i < 512; i++) {
|
||||||
System.out.println("i:" + i + " = b:" + binaryByte.apply(i));
|
logger.debug("i:" + i + " = b:" + binaryByte.apply(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ package io.nosqlbench.virtdata.library.curves4.continuous;
|
|||||||
|
|
||||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -30,6 +32,7 @@ import java.util.concurrent.Future;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class RealDistributionsConcurrencyTests {
|
public class RealDistributionsConcurrencyTests {
|
||||||
|
private final static Logger logger = LogManager.getLogger(RealDistributionsConcurrencyTests.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConcurrentBinomialHashValues() {
|
public void testConcurrentBinomialHashValues() {
|
||||||
@ -73,8 +76,7 @@ public class RealDistributionsConcurrencyTests {
|
|||||||
for (int i = 0; i < futures.size(); i++) {
|
for (int i = 0; i < futures.size(); i++) {
|
||||||
try {
|
try {
|
||||||
results.add(futures.get(i).get());
|
results.add(futures.get(i).get());
|
||||||
// System.out.println(description + ": got results for thread " + i);
|
logger.trace(description + ": got results for thread " + i);
|
||||||
// System.out.flush();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -83,7 +85,7 @@ public class RealDistributionsConcurrencyTests {
|
|||||||
|
|
||||||
for (int vthread = 0; vthread < threads; vthread++) {
|
for (int vthread = 0; vthread < threads; vthread++) {
|
||||||
assertThat(results.get(vthread)).isEqualTo(values);
|
assertThat(results.get(vthread)).isEqualTo(values);
|
||||||
System.out.println(description + ": verified values for thread " + vthread);
|
logger.debug(description + ": verified values for thread " + vthread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,8 +109,7 @@ public class RealDistributionsConcurrencyTests {
|
|||||||
public double[] call() throws Exception {
|
public double[] call() throws Exception {
|
||||||
double[] output = new double[size];
|
double[] output = new double[size];
|
||||||
DataMapper<Double> mapper = VirtData.getMapper(mapperSpec, double.class);
|
DataMapper<Double> mapper = VirtData.getMapper(mapperSpec, double.class);
|
||||||
// System.out.println("resolved:" + mapper);
|
logger.trace("resolved:" + mapper);
|
||||||
// System.out.flush();
|
|
||||||
|
|
||||||
synchronized (signal) {
|
synchronized (signal) {
|
||||||
signal.wait(10000);
|
signal.wait(10000);
|
||||||
@ -116,9 +117,9 @@ public class RealDistributionsConcurrencyTests {
|
|||||||
|
|
||||||
for (int i = 0; i < output.length; i++) {
|
for (int i = 0; i < output.length; i++) {
|
||||||
output[i] = mapper.get(i);
|
output[i] = mapper.get(i);
|
||||||
// if ((i % 100) == 0) {
|
if ((i % 100) == 0) {
|
||||||
// System.out.println("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
logger.trace("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.continuous;
|
|||||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Normal;
|
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Normal;
|
||||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
||||||
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.assertj.core.data.Offset;
|
import org.assertj.core.data.Offset;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -29,12 +31,13 @@ import java.util.function.LongToDoubleFunction;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class RealDistributionsValuesTest {
|
public class RealDistributionsValuesTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(RealDistributionsValuesTest.class);
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComputedNormal() {
|
public void testComputedNormal() {
|
||||||
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"compute"), 1000000,1);
|
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"compute"), 1000000,1);
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
assertThat(runData.getFractionalPercentile(0.5D))
|
assertThat(runData.getFractionalPercentile(0.5D))
|
||||||
.isCloseTo(10.0D, Offset.offset(0.01D));
|
.isCloseTo(10.0D, Offset.offset(0.01D));
|
||||||
assertThat(runData.getFractionalPercentile(0.4D))
|
assertThat(runData.getFractionalPercentile(0.4D))
|
||||||
@ -46,7 +49,7 @@ public class RealDistributionsValuesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInterpolatedNormal() {
|
public void testInterpolatedNormal() {
|
||||||
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"interpolate"), 1000000,1);
|
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"interpolate"), 1000000,1);
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
assertThat(runData.getFractionalPercentile(0.5D))
|
assertThat(runData.getFractionalPercentile(0.5D))
|
||||||
.isCloseTo(10.0D, Offset.offset(0.01D));
|
.isCloseTo(10.0D, Offset.offset(0.01D));
|
||||||
assertThat(runData.getFractionalPercentile(0.4D))
|
assertThat(runData.getFractionalPercentile(0.4D))
|
||||||
@ -64,7 +67,7 @@ public class RealDistributionsValuesTest {
|
|||||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||||
assertThat(runData.getFractionalPercentile(0.78D))
|
assertThat(runData.getFractionalPercentile(0.78D))
|
||||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -76,7 +79,7 @@ public class RealDistributionsValuesTest {
|
|||||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||||
assertThat(runData.getFractionalPercentile(0.78D))
|
assertThat(runData.getFractionalPercentile(0.78D))
|
||||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -92,7 +95,7 @@ public class RealDistributionsValuesTest {
|
|||||||
|
|
||||||
assertThat(mapper.applyAsDouble(Long.MAX_VALUE)).isCloseTo(100.0D, Offset.offset(1.0D));
|
assertThat(mapper.applyAsDouble(Long.MAX_VALUE)).isCloseTo(100.0D, Offset.offset(1.0D));
|
||||||
|
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RunData iterateMapperDouble(LongToDoubleFunction mapper, int iterations, long funcstep) {
|
private RunData iterateMapperDouble(LongToDoubleFunction mapper, int iterations, long funcstep) {
|
||||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.discrete;
|
|||||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||||
import org.apache.commons.statistics.distribution.BinomialDistribution;
|
import org.apache.commons.statistics.distribution.BinomialDistribution;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.assertj.core.data.Offset;
|
import org.assertj.core.data.Offset;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ import java.util.concurrent.Future;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class IntegerDistributionsConcurrencyTest {
|
public class IntegerDistributionsConcurrencyTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(IntegerDistributionsConcurrencyTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBinomialICDR() {
|
public void testBinomialICDR() {
|
||||||
@ -109,7 +112,6 @@ public class IntegerDistributionsConcurrencyTest {
|
|||||||
try {
|
try {
|
||||||
results[i] = futures.get(i).get();
|
results[i] = futures.get(i).get();
|
||||||
System.out.println(description + ": got results for thread " + i);
|
System.out.println(description + ": got results for thread " + i);
|
||||||
System.out.flush();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -125,15 +127,14 @@ public class IntegerDistributionsConcurrencyTest {
|
|||||||
for (int ithread = 0; ithread < threads; ithread++) {
|
for (int ithread = 0; ithread < threads; ithread++) {
|
||||||
System.out.print(results[ithread][i] + ",");
|
System.out.print(results[ithread][i] + ",");
|
||||||
}
|
}
|
||||||
System.out.println();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean equal = Arrays.equals(results[vthread],values);
|
boolean equal = Arrays.equals(results[vthread],values);
|
||||||
if (!equal) {
|
if (!equal) {
|
||||||
System.out.println("not equal!");
|
logger.debug("not equal!");
|
||||||
}
|
}
|
||||||
assertThat(results[vthread]).isEqualTo(values);
|
assertThat(results[vthread]).isEqualTo(values);
|
||||||
System.out.println(description + ": verified values for thread " + vthread);
|
logger.debug(description + ": verified values for thread " + vthread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,8 +158,7 @@ public class IntegerDistributionsConcurrencyTest {
|
|||||||
public long[] call() throws Exception {
|
public long[] call() throws Exception {
|
||||||
long[] output = new long[size];
|
long[] output = new long[size];
|
||||||
DataMapper<Long> mapper = VirtData.getMapper(mapperSpec, long.class);
|
DataMapper<Long> mapper = VirtData.getMapper(mapperSpec, long.class);
|
||||||
// System.out.println("resolved:" + mapper);
|
// logger.debug("resolved:" + mapper);
|
||||||
// System.out.flush();
|
|
||||||
|
|
||||||
synchronized (signal) {
|
synchronized (signal) {
|
||||||
signal.wait(10000);
|
signal.wait(10000);
|
||||||
@ -167,7 +167,7 @@ public class IntegerDistributionsConcurrencyTest {
|
|||||||
for (int i = 0; i < output.length; i++) {
|
for (int i = 0; i < output.length; i++) {
|
||||||
output[i] = mapper.get(i);
|
output[i] = mapper.get(i);
|
||||||
// if ((i % 100) == 0) {
|
// if ((i % 100) == 0) {
|
||||||
// System.out.println("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
// logger.debug("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.discrete;
|
|||||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
||||||
import io.nosqlbench.virtdata.library.curves4.discrete.long_long.Zipf;
|
import io.nosqlbench.virtdata.library.curves4.discrete.long_long.Zipf;
|
||||||
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.assertj.core.data.Offset;
|
import org.assertj.core.data.Offset;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -31,13 +33,14 @@ import java.util.function.LongUnaryOperator;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class IntegerDistributionsValuesTest {
|
public class IntegerDistributionsValuesTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(IntegerDistributionsValuesTest.class);
|
||||||
|
|
||||||
|
|
||||||
@Disabled
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
public void testComputedZipf() {
|
public void testComputedZipf() {
|
||||||
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
assertThat(runData.getFractionalPercentile(0.6D))
|
assertThat(runData.getFractionalPercentile(0.6D))
|
||||||
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
||||||
assertThat(runData.getFractionalPercentile(0.7D))
|
assertThat(runData.getFractionalPercentile(0.7D))
|
||||||
@ -51,7 +54,7 @@ public class IntegerDistributionsValuesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInterpolatedZipf() {
|
public void testInterpolatedZipf() {
|
||||||
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
assertThat(runData.getFractionalPercentile(0.6D))
|
assertThat(runData.getFractionalPercentile(0.6D))
|
||||||
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
||||||
assertThat(runData.getFractionalPercentile(0.7D))
|
assertThat(runData.getFractionalPercentile(0.7D))
|
||||||
@ -72,7 +75,7 @@ public class IntegerDistributionsValuesTest {
|
|||||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||||
assertThat(runData.getFractionalPercentile(0.78D))
|
assertThat(runData.getFractionalPercentile(0.78D))
|
||||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -84,7 +87,7 @@ public class IntegerDistributionsValuesTest {
|
|||||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||||
assertThat(runData.getFractionalPercentile(0.78D))
|
assertThat(runData.getFractionalPercentile(0.78D))
|
||||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -127,7 +130,7 @@ public class IntegerDistributionsValuesTest {
|
|||||||
int readout = iterations/10;
|
int readout = iterations/10;
|
||||||
for (int i = 0; i < iterations; i++) {
|
for (int i = 0; i < iterations; i++) {
|
||||||
if ((i%readout)==0) {
|
if ((i%readout)==0) {
|
||||||
System.out.println("i="+i+"/"+iterations);
|
logger.debug("i="+i+"/"+iterations);
|
||||||
}
|
}
|
||||||
samples[i] = mapper.applyAsDouble(i);
|
samples[i] = mapper.applyAsDouble(i);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ import io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.Identity;
|
|||||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.NumberNameToString;
|
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.NumberNameToString;
|
||||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Template;
|
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Template;
|
||||||
import org.apache.commons.lang3.ClassUtils;
|
import org.apache.commons.lang3.ClassUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -33,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||||
|
|
||||||
public class IntegratedComposerLogicTest {
|
public class IntegratedComposerLogicTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(IntegratedComposerLogicTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPreferredReturnType() {
|
public void testPreferredReturnType() {
|
||||||
|
@ -19,6 +19,8 @@ package io.virtdata;
|
|||||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.assertj.core.data.Offset;
|
import org.assertj.core.data.Offset;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -27,15 +29,14 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
//import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
|
||||||
|
|
||||||
public class IntegratedCurvesTest {
|
public class IntegratedCurvesTest {
|
||||||
|
private final static Logger logger = LogManager.getLogger(IntegratedComposerLogicTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testZipf() {
|
public void testZipf() {
|
||||||
DataMapper<Long> mapper = VirtData.getMapper("Zipf(1000,2) -> long", long.class);
|
DataMapper<Long> mapper = VirtData.getMapper("Zipf(1000,2) -> long", long.class);
|
||||||
RunData runData = iterateMapperLong(mapper, 10000);
|
RunData runData = iterateMapperLong(mapper, 10000);
|
||||||
System.out.println(runData);
|
logger.debug(runData);
|
||||||
|
|
||||||
assertThat(runData.getStats().getPercentile(0.1d)).isCloseTo(1.0, Offset.offset(0.01d));
|
assertThat(runData.getStats().getPercentile(0.1d)).isCloseTo(1.0, Offset.offset(0.01d));
|
||||||
assertThat(runData.getStats().getPercentile(1.0d)).isCloseTo(1.0, Offset.offset(0.01d));
|
assertThat(runData.getStats().getPercentile(1.0d)).isCloseTo(1.0, Offset.offset(0.01d));
|
||||||
|
Loading…
Reference in New Issue
Block a user