diff --git a/convex-gui/src/main/java/convex/gui/manager/PeerGUI.java b/convex-gui/src/main/java/convex/gui/manager/PeerGUI.java index e4b78886d..e8442fd7b 100644 --- a/convex-gui/src/main/java/convex/gui/manager/PeerGUI.java +++ b/convex-gui/src/main/java/convex/gui/manager/PeerGUI.java @@ -62,7 +62,7 @@ public class PeerGUI extends JPanel { public static List KEYPAIRS=new ArrayList<>(); - private static final int NUM_PEERS=5; + private static final int NUM_PEERS=3; static { for (int i=0; i(); + txTypeBox.addItem("Define Data"); + // txTypeBox.addItem("Transfer"); + // txTypeBox.addItem("AMM Trade"); + txTypeBox.addItem("Null Op"); + optionPanel.add(lblTxType); + optionPanel.add(txTypeBox); // ========================================= @@ -150,6 +159,8 @@ public StressPanel(Convex peerView) { private JSplitPane splitPane; private JPanel resultPanel; private JTextArea resultArea; + + private JComboBox txTypeBox; NumberFormat formatter = new DecimalFormat("#0.000"); @@ -159,13 +170,18 @@ private synchronized void runStressTest() { Address address=peerConvex.getAddress(); AKeyPair kp=peerConvex.getKeyPair(); - int transCount = (Integer) transactionCountSpinner.getValue(); - int requestCount = (Integer) requestCountSpinner.getValue(); - int opCount = (Integer) opCountSpinner.getValue(); - // TODO: enable multiple clients - int clientCount = (Integer) clientCountSpinner.getValue(); new SwingWorker() { + int transCount = (Integer) transactionCountSpinner.getValue(); + int requestCount = (Integer) requestCountSpinner.getValue(); + int opCount = (Integer) opCountSpinner.getValue(); + // TODO: enable multiple clients + int clientCount = (Integer) clientCountSpinner.getValue(); + String type=(String) txTypeBox.getSelectedItem(); + + ArrayList kps=new ArrayList<>(clientCount); + ArrayList clients=new ArrayList<>(clientCount); + @Override protected String doInBackground() throws Exception { StringBuilder sb = new StringBuilder(); @@ -177,27 +193,25 @@ protected String doInBackground() throws Exception { // Stores.setCurrent(Stores.CLIENT_STORE); ArrayList> frs=new ArrayList<>(); Convex pc = Convex.connect(sa, address,kp); - - ArrayList kps=new ArrayList<>(clientCount); - for (int i=0; i v=ccr.getValue(); + AVector
clientAddresses=ccr.getValue(); - ArrayList ccs=new ArrayList<>(clientCount); for (int i=0; i> cfutures=Utils.threadMap (cc->{ try { for (int i = 0; i < requestCount; i++) { - StringBuilder tsb = new StringBuilder(); - tsb.append("(def a (do "); - for (int j = 0; j < opCount; j++) { - tsb.append(" (* 10 " + i + ")"); - } - tsb.append("))"); - String source = tsb.toString(); Address origin=cc.getAddress(); - - ATransaction t = Invoke.create(origin,-1, Reader.read(source)); - if (transCount!=1) { - ATransaction[] trxs=new ATransaction[transCount]; - for (int k=0; k fr; if (syncCheckBox.isSelected()) { @@ -252,7 +251,7 @@ protected String doInBackground() throws Exception { throw Utils.sneakyThrow(e); } return null; - },ccs); + },clients); // wait for everything to be sent for (int i=0; i1) tsb.append("(do "); + for (int j = 0; j < opCount; j++) { + switch(type) { + case "Define Data": tsb.append("(def a"+j+" "+reqNo+") "); break; + case "Null Op": tsb.append("nil "); break; + } + } + if (opCount>1) tsb.append(")"); + String source = tsb.toString(); + ATransaction t = Invoke.create(origin,-1, Reader.read(source)); + return t; + } + @Override protected void done() { try {