}
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();
chart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, now - 1)); //-1 because row.add(thread.getStartTime() - 1, 0)
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();