Search in sources :

Example 1 with Probe

use of com.hazelcast.simulator.probes.Probe in project hazelcast-simulator by hazelcast.

the class TestContainer_TimeStep_AsyncSupportTest method getProbeTotalCount.

private static long getProbeTotalCount(String probeName, TestContainer container) {
    Map<String, Probe> probeMap = container.getProbeMap();
    HdrProbe probe = (HdrProbe) probeMap.get(probeName);
    Recorder recorder = probe.getRecorder();
    return recorder.getIntervalHistogram().getTotalCount();
}
Also used : HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe) Recorder(org.HdrHistogram.Recorder) Probe(com.hazelcast.simulator.probes.Probe) HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe)

Example 2 with Probe

use of com.hazelcast.simulator.probes.Probe in project hazelcast-simulator by hazelcast.

the class TestPerformanceTracker method makeUpdate.

private void makeUpdate(long updateIntervalMillis, long currentTimeMillis) {
    Map<String, Probe> probeMap = testContainer.getProbeMap();
    Map<String, Histogram> intervalHistograms = new HashMap<String, Histogram>(probeMap.size());
    long intervalPercentileLatency = -1;
    double intervalMean = -1;
    long intervalMaxLatency = -1;
    long iterations = testContainer.iteration() - iterationsDuringWarmup;
    long intervalOperationCount = iterations - lastIterations;
    for (Map.Entry<String, Probe> entry : probeMap.entrySet()) {
        String probeName = entry.getKey();
        Probe probe = entry.getValue();
        if (!(probe instanceof HdrProbe)) {
            continue;
        }
        HdrProbe hdrProbe = (HdrProbe) probe;
        Histogram intervalHistogram = hdrProbe.getRecorder().getIntervalHistogram();
        intervalHistogram.setStartTimeStamp(lastUpdateMillis);
        intervalHistogram.setEndTimeStamp(currentTimeMillis);
        intervalHistograms.put(probeName, intervalHistogram);
        long percentileValue = intervalHistogram.getValueAtPercentile(INTERVAL_LATENCY_PERCENTILE);
        if (percentileValue > intervalPercentileLatency) {
            intervalPercentileLatency = percentileValue;
        }
        double meanLatency = intervalHistogram.getMean();
        if (meanLatency > intervalMean) {
            intervalMean = meanLatency;
        }
        long maxValue = intervalHistogram.getMaxValue();
        if (maxValue > intervalMaxLatency) {
            intervalMaxLatency = maxValue;
        }
        if (probe.isPartOfTotalThroughput()) {
            intervalOperationCount += intervalHistogram.getTotalCount();
        }
    }
    this.intervalHistogramMap = intervalHistograms;
    this.intervalLatency999PercentileNanos = intervalPercentileLatency;
    this.intervalLatencyAvgNanos = intervalMean;
    this.intervalLatencyMaxNanos = intervalMaxLatency;
    this.intervalOperationCount = intervalOperationCount;
    this.totalOperationCount += intervalOperationCount;
    long intervalTimeDelta = currentTimeMillis - lastUpdateMillis;
    long totalTimeDelta = currentTimeMillis - startMeasuringTime();
    this.intervalThroughput = (intervalOperationCount * ONE_SECOND_IN_MILLIS) / (double) intervalTimeDelta;
    this.totalThroughput = (totalOperationCount * ONE_SECOND_IN_MILLIS / (double) totalTimeDelta);
    this.lastIterations = iterations;
    this.nextUpdateMillis += updateIntervalMillis;
    this.lastUpdateMillis = currentTimeMillis;
}
Also used : Histogram(org.HdrHistogram.Histogram) HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe) HashMap(java.util.HashMap) Probe(com.hazelcast.simulator.probes.Probe) HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with Probe

use of com.hazelcast.simulator.probes.Probe in project hazelcast-simulator by hazelcast.

the class TestPerformanceTracker method skipUpdate.

private boolean skipUpdate(long updateIntervalMillis, long currentTimeMillis) {
    long runStartedMillis = testContainer.getRunStartedMillis();
    if (!testContainer.isRunning() || runStartedMillis == 0) {
        // the test hasn't started
        return true;
    }
    if (lastUpdateMillis == 0) {
        // first time
        iterationsDuringWarmup = testContainer.iteration();
        for (Probe probe : testContainer.getProbeMap().values()) {
            probe.reset();
        }
        lastUpdateMillis = currentTimeMillis;
        nextUpdateMillis = lastUpdateMillis + updateIntervalMillis;
        return true;
    }
    return nextUpdateMillis > currentTimeMillis;
}
Also used : Probe(com.hazelcast.simulator.probes.Probe) HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe)

Example 4 with Probe

use of com.hazelcast.simulator.probes.Probe in project hazelcast-simulator by hazelcast.

the class PropertyBinding method getOrCreateProbe.

public Probe getOrCreateProbe(String probeName, boolean partOfTotalThroughput) {
    if (probeClass == null) {
        return EmptyProbe.INSTANCE;
    }
    Probe probe = probeMap.get(probeName);
    if (probe == null) {
        probe = new HdrProbe(partOfTotalThroughput);
        probeMap.put(probeName, probe);
    }
    return probe;
}
Also used : HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe) EmptyProbe(com.hazelcast.simulator.probes.impl.EmptyProbe) Probe(com.hazelcast.simulator.probes.Probe) HdrProbe(com.hazelcast.simulator.probes.impl.HdrProbe)

Example 5 with Probe

use of com.hazelcast.simulator.probes.Probe in project hazelcast-simulator by hazelcast.

the class TestContainer method registerTestPhaseTasks.

private void registerTestPhaseTasks() {
    try {
        registerSetupTask();
        registerPrepareTasks(false);
        registerPrepareTasks(true);
        taskPerPhaseMap.put(RUN, new Callable() {

            @Override
            public Object call() throws Exception {
                if (propertyBinding.recordJitter) {
                    Probe probe = propertyBinding.getOrCreateProbe("jitter", false);
                    new JitterThread(testContext, probe, propertyBinding.recordJitterThresholdNs).start();
                }
                return runStrategy.getRunCallable().call();
            }
        });
        registerTask(Verify.class, new VerifyFilter(false), LOCAL_VERIFY);
        registerTask(Verify.class, new VerifyFilter(true), GLOBAL_VERIFY);
        registerTask(Teardown.class, new TeardownFilter(false), LOCAL_TEARDOWN);
        registerTask(Teardown.class, new TeardownFilter(true), GLOBAL_TEARDOWN);
    } catch (IllegalTestException e) {
        throw rethrow(e);
    } catch (Exception e) {
        throw new IllegalTestException(format("Error during search for annotated test methods in %s: [%s] %s", testClass.getName(), e.getClass().getSimpleName(), e.getMessage()), e);
    }
}
Also used : VerifyFilter(com.hazelcast.simulator.utils.AnnotationFilter.VerifyFilter) Probe(com.hazelcast.simulator.probes.Probe) Callable(java.util.concurrent.Callable) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeardownFilter(com.hazelcast.simulator.utils.AnnotationFilter.TeardownFilter)

Aggregations

Probe (com.hazelcast.simulator.probes.Probe)7 HdrProbe (com.hazelcast.simulator.probes.impl.HdrProbe)4 Test (org.junit.Test)2 EmptyProbe (com.hazelcast.simulator.probes.impl.EmptyProbe)1 TeardownFilter (com.hazelcast.simulator.utils.AnnotationFilter.TeardownFilter)1 VerifyFilter (com.hazelcast.simulator.utils.AnnotationFilter.VerifyFilter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 Histogram (org.HdrHistogram.Histogram)1 Recorder (org.HdrHistogram.Recorder)1