disable sysperf and extra tests

This commit is contained in:
Jonathan Shook
2020-02-25 12:49:29 -06:00
parent 607fdc58c9
commit ecf1fa5afd
4 changed files with 202 additions and 196 deletions

View File

@@ -25,8 +25,14 @@ import java.util.concurrent.locks.LockSupport;
public class LeastWorstDelay {
public final static SysPerfData perfdata = SysPerf.get().getPerfData(false);
private final static long sleepThreshold = (long) perfdata.getAvgNanos_Thread_Sleep();
private final static long parkThreshold = (long) perfdata.getAvgNanos_LockSupport_ParkNanos();
//private final static long sleepThreshold = (long) perfdata
//.getAvgNanos_Thread_Sleep();
//private final static long parkThreshold = (long) perfdata
//.getAvgNanos_LockSupport_ParkNanos();
private final static long sleepThreshold = 1_000_000;
private final static long parkThreshold = 20;
/**
* We wish for the JVM to inline this.
@@ -46,13 +52,13 @@ public class LeastWorstDelay {
public static void delayAsIfFor(long nanos) {
if (nanos > 0) {
if (nanos > sleepThreshold) {
nanos-=sleepThreshold;
nanos -= sleepThreshold;
try {
Thread.sleep((nanos / 1000000), (int) (nanos % 1000000));
} catch (InterruptedException ignored) {
}
} else if (nanos > parkThreshold) {
nanos-=parkThreshold;
nanos -= parkThreshold;
LockSupport.parkNanos(nanos);
}
}
@@ -86,20 +92,19 @@ public class LeastWorstDelay {
* this method in other scenarios.
*
* @param targetNanoTime The system nanos that the delay should attempt to return at.
* perfect accuracy, which doesn't happen
*
* perfect accuracy, which doesn't happen
*/
public void delayAsIfUntil(long targetNanoTime) {
long nanos = Math.max(targetNanoTime - System.nanoTime(),0L);
long nanos = Math.max(targetNanoTime - System.nanoTime(), 0L);
if (nanos > 0) {
if (nanos > sleepThreshold) {
nanos-=sleepThreshold;
nanos -= sleepThreshold;
try {
Thread.sleep((nanos / 1000000), (int) (nanos % 1000000));
} catch (InterruptedException ignored) {
}
} else if (nanos > parkThreshold) {
nanos-=parkThreshold;
nanos -= parkThreshold;
LockSupport.parkNanos(nanos);
} // else there is nothing shorter than this besides spinning, and we're not doing that
}

View File

@@ -18,8 +18,6 @@
package io.nosqlbench.engine.api.activityapi.ratelimits;
import com.codahale.metrics.Timer;
import io.nosqlbench.engine.api.activityapi.sysperf.SysPerf;
import io.nosqlbench.engine.api.activityapi.sysperf.SysPerfData;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
import org.slf4j.Logger;
@@ -33,7 +31,8 @@ public class TokenFiller implements Runnable {
public final static double MIN_PER_SECOND = 10D;
public final static double MAX_PER_SECOND = 1000D;
private final SysPerfData PERFDATA = SysPerf.get().getPerfData(false);
// private final SysPerfData PERFDATA = SysPerf.get().getPerfData
// (false);
private final long interval = (long) 1E6;
private final TokenPool tokenPool;

View File

@@ -41,10 +41,12 @@ public class SysPerf {
}
public synchronized static SysPerf get() {
if (instance == null) {
instance = new SysPerf();
}
return instance;
throw new RuntimeException("This should not be used in this " +
"release.");
// if (instance == null) {
// instance = new SysPerf();
// }
// return instance;
}
private static File getPerfCacheFile() {