1 import java.util.ArrayList;
3 import net.sf.openrocket.simulation.SimulationListener;
4 import net.sf.openrocket.simulation.exception.SimulationException;
5 import net.sf.openrocket.simulation.listeners.AbstractSimulationListener;
10 public static int COUNT = 1000000;
12 public static void main(String[] args) throws Exception {
14 System.out.println("COUNT="+COUNT);
16 for (int i=1; ; i++) {
17 long t1 = System.currentTimeMillis();
19 long t2 = System.currentTimeMillis();
20 System.out.printf("Run %2d took %d ms, %.1f ms / 1000 rounds\n",
21 i, (t2-t1), ((t2-t1)*1000.0/COUNT));
27 static volatile ArrayList<SimulationListener> listeners = new ArrayList<SimulationListener>();
29 for (int i=0; i<5; i++) {
30 listeners.add(new AbstractSimulationListener());
33 private static void run() throws SimulationException {
36 for (int i=0; i<COUNT; i++) {
37 SimulationListener[] array = listeners.toArray(new SimulationListener[0]);
38 for (SimulationListener l: array) {
39 l.forceCalculation(null, null, null);