Search in sources :

Example 1 with DateTimeRenderer

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

the class FreeFormArrivalsThreadGroupGui method updateChart.

protected void updateChart(AbstractDynamicThreadGroup tg) {
    FreeFormArrivalsThreadGroup atg = (FreeFormArrivalsThreadGroup) tg;
    CollectionProperty data = atg.getData();
    chartModel.clear();
    previewChart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(getRowColor());
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    // initial value to force min Y
    row.add(0, 0);
    JMeterVariableEvaluator evaluator = new JMeterVariableEvaluator();
    int offset = 0;
    double totalArrivals = 0;
    PropertyIterator it = data.iterator();
    while (it.hasNext()) {
        CollectionProperty record = (CollectionProperty) it.next();
        double from = evaluator.getDouble(record.get(0));
        double to = evaluator.getDouble(record.get(1));
        double during = evaluator.getDouble(record.get(2));
        row.add(offset * 1000, from);
        offset += during * tg.getUnitFactor();
        row.add(offset * 1000, to);
        totalArrivals += during * from + during * (to - from) / 2;
    }
    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) JMeterVariableEvaluator(kg.apc.jmeter.JMeterVariableEvaluator) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 2 with DateTimeRenderer

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

the class AbstractOverTimeVisualizer method handleRelativeStartTime.

protected void handleRelativeStartTime() {
    if (graphPanel.getGraphObject().getChartSettings().isUseRelativeTime()) {
        graphPanel.getGraphObject().setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, relativeStartTime));
    }
    graphPanel.getGraphObject().setTestStartTime(relativeStartTime);
    graphPanel.getGraphObject().setForcedMinX(relativeStartTime);
}
Also used : DateTimeRenderer(kg.apc.charting.DateTimeRenderer)

Example 3 with DateTimeRenderer

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

the class AbstractDynamicThreadGroupGui method updateChart.

protected void updateChart(AbstractDynamicThreadGroup atg) {
    double targetRate = atg.getTargetLevelAsDouble();
    long rampUp = atg.getRampUpSeconds();
    long holdFor = atg.getHoldSeconds();
    long stepsCount = atg.getStepsAsLong();
    double unitFactor = atg.getUnitFactor();
    chartModel.clear();
    previewChart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(getRowColor());
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    // initial value to force min Y
    row.add(0, 0);
    double totalArrivals = 0;
    if (stepsCount > 0) {
        double stepSize = targetRate / (double) stepsCount;
        double stepLen = rampUp / (double) stepsCount;
        for (int n = 1; n <= stepsCount; n++) {
            double stepRate = stepSize * n;
            row.add(Math.round((n - 1) * stepLen * 1000), stepRate);
            row.add(Math.round(n * stepLen * 1000), stepRate);
            totalArrivals += stepLen * stepRate;
        }
    } else {
        row.add(rampUp * 1000, targetRate);
        totalArrivals += rampUp * targetRate / 2.0;
    }
    row.add((rampUp + holdFor) * 1000, targetRate);
    totalArrivals += holdFor * targetRate;
    totalArrivals /= unitFactor;
    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 4 with DateTimeRenderer

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

the class SteppingThreadGroupGui method updateChart.

private void updateChart(SteppingThreadGroup tg) {
    model.clear();
    GraphRowSumValues row = new GraphRowSumValues();
    row.setColor(Color.RED);
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    final HashTree hashTree = new HashTree();
    hashTree.add(new LoopController());
    JMeterThread thread = new JMeterThread(hashTree, null, null);
    long now = System.currentTimeMillis();
    // test start
    // -1 because row.add(thread.getStartTime() - 1, 0)
    chart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, now - 1));
    row.add(now, 0);
    row.add(now + tg.getThreadGroupDelayAsInt(), 0);
    int numThreads = tg.getNumThreads();
    // users in
    for (int n = 0; n < numThreads; n++) {
        thread.setThreadNum(n);
        tg.scheduleThread(thread, now);
        row.add(thread.getStartTime() - 1, 0);
        row.add(thread.getStartTime(), 1);
    }
    // users out
    for (int n = 0; n < numThreads; n++) {
        thread.setThreadNum(n);
        tg.scheduleThread(thread, now);
        row.add(thread.getEndTime() - 1, 0);
        row.add(thread.getEndTime(), -1);
    }
    model.put("Expected Active Users Count", row);
    chart.invalidateCache();
    chart.repaint();
}
Also used : HashTree(org.apache.jorphan.collections.HashTree) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) GraphRowSumValues(kg.apc.charting.rows.GraphRowSumValues) JMeterThread(org.apache.jmeter.threads.JMeterThread) LoopController(org.apache.jmeter.control.LoopController)

Example 5 with DateTimeRenderer

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

the class UltimateThreadGroupGui method updateChart.

private void updateChart(UltimateThreadGroup tg) {
    tg.testStarted();
    model.clear();
    GraphRowSumValues row = new GraphRowSumValues();
    row.setColor(Color.RED);
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    final HashTree hashTree = new HashTree();
    hashTree.add(new LoopController());
    JMeterThread thread = new JMeterThread(hashTree, null, null);
    long now = System.currentTimeMillis();
    // -1 because row.add(thread.getStartTime() - 1, 0)
    chart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, now - 1));
    chart.setForcedMinX(now);
    row.add(now, 0);
    // users in
    int numThreads = tg.getNumThreads();
    log.debug("Num Threads: " + numThreads);
    for (int n = 0; n < numThreads; n++) {
        thread.setThreadNum(n);
        thread.setThreadName(Integer.toString(n));
        tg.scheduleThread(thread, now);
        row.add(thread.getStartTime() - 1, 0);
        row.add(thread.getStartTime(), 1);
    }
    tg.testStarted();
    // users out
    for (int n = 0; n < tg.getNumThreads(); n++) {
        thread.setThreadNum(n);
        thread.setThreadName(Integer.toString(n));
        tg.scheduleThread(thread, now);
        row.add(thread.getEndTime() - 1, 0);
        row.add(thread.getEndTime(), -1);
    }
    model.put("Expected parallel users count", row);
    chart.invalidateCache();
    chart.repaint();
}
Also used : HashTree(org.apache.jorphan.collections.HashTree) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) GraphRowSumValues(kg.apc.charting.rows.GraphRowSumValues) JMeterThread(org.apache.jmeter.threads.JMeterThread) LoopController(org.apache.jmeter.control.LoopController)

Aggregations

DateTimeRenderer (kg.apc.charting.DateTimeRenderer)6 AbstractGraphRow (kg.apc.charting.AbstractGraphRow)3 GraphRowExactValues (kg.apc.charting.rows.GraphRowExactValues)3 GraphRowSumValues (kg.apc.charting.rows.GraphRowSumValues)2 LoopController (org.apache.jmeter.control.LoopController)2 JMeterThread (org.apache.jmeter.threads.JMeterThread)2 HashTree (org.apache.jorphan.collections.HashTree)2 JMeterVariableEvaluator (kg.apc.jmeter.JMeterVariableEvaluator)1 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)1 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)1