Search in sources :

Example 6 with GraphPanelChartAverageElement

use of kg.apc.charting.elements.GraphPanelChartAverageElement in project jmeter-plugins by undera.

the class AutoStop method testStarted.

@Override
public void testStarted() {
    curSec = 0;
    stopTries = 0;
    avgRespTime = new GraphPanelChartAverageElement();
    errorRate = new GraphPanelChartAverageElement();
    avgRespLatency = new GraphPanelChartAverageElement();
    errRateExceededStart = 0;
    respTimeExceededStart = 0;
    respLatencyExceededStart = 0;
    // init test values
    testValueError = getErrorRateAsFloat();
    testValueErrorSec = getErrorRateSecsAsInt();
    testValueRespLatency = getResponseLatencyAsInt();
    testValueRespLatencySec = getResponseLatencySecsAsInt();
    testValueRespTime = getResponseTimeAsInt();
    testValueRespTimeSec = getResponseTimeSecsAsInt();
}
Also used : GraphPanelChartAverageElement(kg.apc.charting.elements.GraphPanelChartAverageElement)

Example 7 with GraphPanelChartAverageElement

use of kg.apc.charting.elements.GraphPanelChartAverageElement in project jmeter-plugins by undera.

the class AutoStop method sampleOccurred.

@Override
public void sampleOccurred(SampleEvent se) {
    long sec = System.currentTimeMillis() / 1000;
    if (curSec != sec) {
        if (testValueRespTime > 0) {
            // log.debug("Avg resp time: "+avgRespTime.getValue());
            if (avgRespTime.getValue() > testValueRespTime) {
                // log.debug((sec - respTimeExceededStart)+" "+getResponseTimeSecsAsInt());
                if (sec - respTimeExceededStart >= testValueRespTimeSec) {
                    log.info("Average Response Time is more than " + getResponseTime() + " for " + getResponseTimeSecs() + "s. Auto-shutdown test...");
                    System.out.println("AutoStop - Average Response Time is more than " + getResponseTime() + " for " + getResponseTimeSecs() + "s. Auto-shutdown test...");
                    stopTest();
                }
            } else {
                respTimeExceededStart = sec;
            }
        }
        if (testValueRespLatency > 0) {
            // log.debug("Avg resp time: "+avgRespTime.getValue());
            if (avgRespLatency.getValue() > testValueRespLatency) {
                // log.debug((sec - respTimeExceededStart)+" "+getResponseTimeSecsAsInt());
                if (sec - respLatencyExceededStart >= testValueRespLatencySec) {
                    log.info("Average Latency Time is more than " + getResponseLatency() + " for " + getResponseLatencySecs() + "s. Auto-shutdown test...");
                    System.out.println("AutoStop - Average Latency Time is more than " + getResponseLatency() + " for " + getResponseLatencySecs() + "s. Auto-shutdown test...");
                    stopTest();
                }
            } else {
                respLatencyExceededStart = sec;
            }
        }
        if (testValueError > 0) {
            // log.debug("Error rate: "+errorRate.getValue()+"/"+getErrorRateAsFloat());
            if (errorRate.getValue() > testValueError) {
                // log.debug((sec - errRateExceededStart)+" "+getErrorRateSecsAsInt());
                if (sec - errRateExceededStart >= testValueErrorSec) {
                    log.info("Error rate more than " + getErrorRate() + " for " + getErrorRateSecs() + "s. Auto-shutdown test...");
                    System.out.println("AutoStop - Error rate more than " + getErrorRate() + " for " + getErrorRateSecs() + "s. Auto-shutdown test...");
                    stopTest();
                }
            } else {
                errRateExceededStart = sec;
            }
        }
        curSec = sec;
        avgRespTime = new GraphPanelChartAverageElement();
        avgRespLatency = new GraphPanelChartAverageElement();
        errorRate = new GraphPanelChartAverageElement();
    }
    avgRespTime.add(se.getResult().getTime());
    avgRespLatency.add(se.getResult().getLatency());
    errorRate.add(se.getResult().isSuccessful() ? 0 : 1);
}
Also used : GraphPanelChartAverageElement(kg.apc.charting.elements.GraphPanelChartAverageElement)

Aggregations

GraphPanelChartAverageElement (kg.apc.charting.elements.GraphPanelChartAverageElement)7 AbstractGraphPanelChartElement (kg.apc.charting.AbstractGraphPanelChartElement)3 GraphRowOverallAverages (kg.apc.charting.rows.GraphRowOverallAverages)3