use of java.util.concurrent.ConcurrentSkipListMap in project jmeter-plugins by undera.
the class GraphModelToCsvExporterTest method createTestModel.
private ConcurrentSkipListMap<String, AbstractGraphRow> createTestModel() {
ConcurrentSkipListMap<String, AbstractGraphRow> testModel = new ConcurrentSkipListMap<>();
Calendar now = Calendar.getInstance();
now.set(Calendar.HOUR_OF_DAY, 10);
now.set(Calendar.MINUTE, 30);
now.set(Calendar.SECOND, 0);
now.set(Calendar.MILLISECOND, 500);
GraphRowAverages row1 = new GraphRowAverages();
GraphRowAverages row2 = new GraphRowAverages();
GraphRowAverages row3 = new GraphRowAverages();
testModel.put("row1", row1);
testModel.put("row2", row2);
testModel.put("row3", row3);
row1.add(now.getTimeInMillis(), 10);
row2.add(now.getTimeInMillis(), 20);
now.set(Calendar.SECOND, 10);
row1.add(now.getTimeInMillis(), 20);
row2.add(now.getTimeInMillis(), 30);
now.set(Calendar.SECOND, 25);
row3.add(now.getTimeInMillis(), 50);
return testModel;
}
use of java.util.concurrent.ConcurrentSkipListMap in project jmeter-plugins by undera.
the class GraphPanelChartTest method testPaintComponent.
/**
* Test of paintComponent method, of class GraphPanelChart.
*/
@Test
public void testPaintComponent() {
System.out.println("paintComponent");
Graphics g = new TestGraphics();
GraphPanelChart instance = new GraphPanelChart();
instance.setSize(500, 500);
instance.getChartSettings().setDrawFinalZeroingLines(true);
instance.getChartSettings().setDrawCurrentX(true);
instance.getChartSettings().setExpendRows(true);
final ConcurrentSkipListMap<String, AbstractGraphRow> rows = new ConcurrentSkipListMap<String, AbstractGraphRow>();
instance.setRows(rows);
final GraphRowAverages row1 = new GraphRowAverages();
row1.setDrawThickLines(true);
row1.setDrawLine(true);
row1.setDrawBar(true);
row1.setDrawValueLabel(true);
row1.setMarkerSize(AbstractGraphRow.MARKER_SIZE_BIG);
rows.put("test 1", row1);
row1.add(System.currentTimeMillis(), 20);
instance.paintComponent(g);
row1.add(System.currentTimeMillis(), 540);
instance.setxAxisLabelRenderer(new DateTimeRenderer("HH:mm:ss"));
instance.paintComponent(g);
row1.add(System.currentTimeMillis(), 8530);
instance.paintComponent(g);
}
use of java.util.concurrent.ConcurrentSkipListMap in project jmeter-plugins by undera.
the class GraphPanelChartTest method testSaveGraphToCSV.
/**
* Test of saveGraphToCSV method, of class GraphPanelChart.
*/
@Test
public void testSaveGraphToCSV() throws Exception {
System.out.println("saveGraphToCSV");
File file = File.createTempFile("test", ".csv");
GraphPanelChart instance = new GraphPanelChart();
final ConcurrentSkipListMap<String, AbstractGraphRow> rows = new ConcurrentSkipListMap<String, AbstractGraphRow>();
instance.setRows(rows);
instance.saveGraphToCSV(file);
}
use of java.util.concurrent.ConcurrentSkipListMap in project jmeter-plugins by undera.
the class AbstractGraphPanelVisualizerTest method testGetNewRow_9args.
/**
* Test of getNewRow method, of class AbstractGraphPanelVisualizer.
*/
@Test
public void testGetNewRow_9args() {
System.out.println("getNewRow");
ConcurrentSkipListMap<String, AbstractGraphRow> model = new ConcurrentSkipListMap<String, AbstractGraphRow>();
int rowType = 0;
String label = "";
int markerSize = 0;
boolean isBarRow = false;
boolean displayLabel = false;
boolean thickLines = false;
boolean showInLegend = false;
boolean canCompose = false;
AbstractGraphPanelVisualizer instance = new AbstractGraphPanelVisualizerImpl();
AbstractGraphRow result = instance.getNewRow(model, rowType, label, markerSize, isBarRow, displayLabel, thickLines, showInLegend, canCompose);
assertNotNull(result);
}
use of java.util.concurrent.ConcurrentSkipListMap in project accumulo by apache.
the class NativeMapPerformanceTest method runPerformanceTest.
static void runPerformanceTest(int numRows, int numCols, int numLookups, String mapType) {
SortedMap<Key, Value> tm = null;
NativeMap nm = null;
if (mapType.equals("SKIP_LIST"))
tm = new ConcurrentSkipListMap<>();
else if (mapType.equals("TREE_MAP"))
tm = Collections.synchronizedSortedMap(new TreeMap<Key, Value>());
else if (mapType.equals("NATIVE_MAP"))
nm = new NativeMap();
else
throw new IllegalArgumentException(" map type must be SKIP_LIST, TREE_MAP, or NATIVE_MAP");
Random rand = new Random(19);
// puts
long tps = System.currentTimeMillis();
if (nm != null) {
for (int i = 0; i < numRows; i++) {
int row = rand.nextInt(1000000000);
Mutation m = newMutation(row);
for (int j = 0; j < numCols; j++) {
int col = rand.nextInt(1000000);
Value val = new Value("test".getBytes(UTF_8));
pc(m, col, val);
}
nm.mutate(m, i);
}
} else {
for (int i = 0; i < numRows; i++) {
int row = rand.nextInt(1000000000);
for (int j = 0; j < numCols; j++) {
int col = rand.nextInt(1000000);
Key key = newKey(row, col);
Value val = new Value("test".getBytes(UTF_8));
tm.put(key, val);
}
}
}
long tpe = System.currentTimeMillis();
// Iteration
Iterator<Entry<Key, Value>> iter;
if (nm != null) {
iter = nm.iterator();
} else {
iter = tm.entrySet().iterator();
}
long tis = System.currentTimeMillis();
while (iter.hasNext()) {
iter.next();
}
long tie = System.currentTimeMillis();
rand = new Random(19);
int[] rowsToLookup = new int[numLookups];
int[] colsToLookup = new int[numLookups];
for (int i = 0; i < Math.min(numLookups, numRows); i++) {
int row = rand.nextInt(1000000000);
int col = -1;
for (int j = 0; j < numCols; j++) {
col = rand.nextInt(1000000);
}
rowsToLookup[i] = row;
colsToLookup[i] = col;
}
// get
long tgs = System.currentTimeMillis();
if (nm != null) {
for (int i = 0; i < numLookups; i++) {
Key key = newKey(rowsToLookup[i], colsToLookup[i]);
if (nm.get(key) == null) {
throw new RuntimeException("Did not find " + rowsToLookup[i] + " " + colsToLookup[i] + " " + i);
}
}
} else {
for (int i = 0; i < numLookups; i++) {
Key key = newKey(rowsToLookup[i], colsToLookup[i]);
if (tm.get(key) == null) {
throw new RuntimeException("Did not find " + rowsToLookup[i] + " " + colsToLookup[i] + " " + i);
}
}
}
long tge = System.currentTimeMillis();
long memUsed = 0;
if (nm != null) {
memUsed = nm.getMemoryUsed();
}
int size = (nm == null ? tm.size() : nm.size());
// delete
long tds = System.currentTimeMillis();
if (nm != null)
nm.delete();
long tde = System.currentTimeMillis();
if (tm != null)
tm.clear();
System.gc();
System.gc();
System.gc();
System.gc();
sleepUninterruptibly(3, TimeUnit.SECONDS);
System.out.printf("mapType:%10s put rate:%,6.2f scan rate:%,6.2f get rate:%,6.2f delete time : %6.2f mem : %,d%n", "" + mapType, (numRows * numCols) / ((tpe - tps) / 1000.0), (size) / ((tie - tis) / 1000.0), numLookups / ((tge - tgs) / 1000.0), (tde - tds) / 1000.0, memUsed);
}
Aggregations