@Override public void add(final SampleResult res) { Calculator row = tableRows.computeIfAbsent(res.getSampleLabel(useGroupName.isSelected()), label -> { Calculator newRow = new Calculator(label); newRows.add(newRow); return newRow; }); /* * Synch is needed because multiple threads can update the counts. */ synchronized (row) { row.addSample(res); } Calculator tot = tableRows.get(TOTAL_ROW_LABEL); synchronized (lock) { tot.addSample(res); } dataChanged = true; }
public void sampleOccurred(SampleEvent e) { if (e.getResult() == null || e.getResult() == null) return; SampleResult s = e.getResult(); long now = System.currentTimeMillis();// in seconds AbstractRunningSampleWrapper totals; synchronized (allTests) { String label = s.getSampleLabel(); if ((totals = allTests.get(label)) == null) { totals = newRunningSampleWrapper(label); totals.start(); allTests.put(label, totals); } } synchronized (totals) { totals.delta.addSample(s); if ((now > totals.totalUpdated + INTERVAL)) { totals.moveDelta(); totals.totalUpdated = now; totals.log(); } } }
while (!newRows.isEmpty()) { res = newRows.pop(); calc.addSample(res); int count = calc.getCount(); TableSample newS = new TableSample(