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);
}
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);
}
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);
}
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();
}
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();
}
Aggregations