Permalink
Browse files

added async JAIterator test

  • Loading branch information...
1 parent 612d038 commit 204739967b68f50c7b4fb6d0d1ad87f6d2ce0853 @laforge49 committed Apr 2, 2013
Showing with 100 additions and 10 deletions.
  1. +0 −1 src/main/java/org/agilewiki/jactor/JAMailboxFactory.java
  2. +0 −1 src/main/java/org/agilewiki/jactor/apc/APCMailbox.java
  3. +0 −1 src/main/java/org/agilewiki/jactor/lpc/JLPCActor.java
  4. +0 −1 src/main/java/org/agilewiki/jactor/parallel/JAResponseCounter3.java
  5. +33 −0 src/test/java/org/agilewiki/jactor/counterTest/CounterTest.java
  6. +3 −0 src/test/java/org/agilewiki/jactor/counterTest/Driver.java
  7. +4 −0 src/test/java/org/agilewiki/jactor/lpc/EventTest.java
  8. +4 −0 src/test/java/org/agilewiki/jactor/lpc/calculatorTest/CalculatorTest.java
  9. +4 −4 src/test/java/org/agilewiki/jactor/lpc/timingTest/AsyncMailboxTest.java
  10. +3 −0 src/test/java/org/agilewiki/jactor/lpc/timingTest/Sender.java
  11. +3 −0 src/test/java/org/agilewiki/jactor/lpc/timingTest/Sender1.java
  12. +2 −2 src/test/java/org/agilewiki/jactor/lpc/timingTest/SharedMailboxTest.java
  13. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/CallTest.java
  14. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/GotoTest.java
  15. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/IfFTest.java
  16. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/IfVTest.java
  17. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/IteratorTest.java
  18. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/ReturnFTest.java
  19. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/ReturnVTest.java
  20. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/SendVFTest.java
  21. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/SendVVTest.java
  22. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/SetFTest.java
  23. +4 −0 src/test/java/org/agilewiki/jactor/simpleMachine/SetVTest.java
@@ -24,7 +24,6 @@
package org.agilewiki.jactor;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Timer;
@@ -27,7 +27,6 @@
import org.agilewiki.jactor.bufferedEvents.BufferedEventsDestination;
import org.agilewiki.jactor.events.EventQueue;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -23,7 +23,6 @@
*/
package org.agilewiki.jactor.lpc;
-import java.util.ArrayList;
import java.util.List;
import org.agilewiki.jactor.Actor;
@@ -25,7 +25,6 @@
import org.agilewiki.jactor.RP;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -2,6 +2,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.Mailbox;
+import org.agilewiki.jactor.MailboxFactory;
/**
* Test code.
@@ -65,4 +69,33 @@ public void testUnshared() throws Exception {
mailboxFactory.close();
}
}
+
+ public void testAsync() throws Exception {
+
+ long runs = 100;
+
+// [java-async] Number of runs: 10000000
+// [java-async] Count: 1000000000
+// [java-async] Test time in seconds: 7.598
+// [java-async] Messages per second: 1316135.8252171625
+
+ MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(10);
+ try {
+ CounterActor counterActor = new CounterActor();
+ counterActor.initialize(mailboxFactory.createAsyncMailbox());
+ Driver driver = new Driver();
+ driver.initialize(mailboxFactory.createMailbox(), counterActor, runs);
+ JAFuture future = new JAFuture();
+ long start = System.currentTimeMillis();
+ Long count = (Long) SimpleRequest.req.send(future, driver);
+ long finish = System.currentTimeMillis();
+ double elapsedTime = (finish - start) / 1000.;
+ System.out.println("[java-async] Number of runs: " + runs);
+ System.out.println("[java-async] Count: " + count);
+ System.out.println("[java-async] Test time in seconds: " + elapsedTime);
+ System.out.println("[java-async] Messages per second: " + runs / elapsedTime);
+ } finally {
+ mailboxFactory.close();
+ }
+ }
}
@@ -2,6 +2,9 @@
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAIterator;
+import org.agilewiki.jactor.Mailbox;
+import org.agilewiki.jactor.RP;
import org.agilewiki.jactor.simpleMachine.ObjectFunc;
import org.agilewiki.jactor.simpleMachine.SimpleMachine;
import org.agilewiki.jactor.simpleMachine._Operation;
@@ -2,6 +2,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -2,6 +2,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.Mailbox;
+import org.agilewiki.jactor.MailboxFactory;
/**
* Test code.
@@ -8,12 +8,12 @@
*/
public class AsyncMailboxTest extends TestCase {
public void testTiming() {
- int c = 2;
- int b = 3;
+ int c = 1000000;
+ int b = 1;
int p = 1;
- int t = 1;
+ int t = 8;
- //System.out.println("####################################################");
+ System.out.println("####################################################");
//int c = 500;
//int b = 1000;
//int p = 1000;
@@ -2,6 +2,9 @@
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.Actor;
+import org.agilewiki.jactor.JAIterator;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -2,6 +2,9 @@
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.Actor;
+import org.agilewiki.jactor.JAIterator;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -8,12 +8,12 @@
*/
public class SharedMailboxTest extends TestCase {
public void testTiming() {
- int c = 1;
+ int c = 1000000;
int b = 1;
int p = 1;
int t = 1;
- //System.out.println("####################################################");
+ System.out.println("####################################################");
//int c = 1000;
//int b = 1000;
//int p = 1000;
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.
@@ -3,6 +3,10 @@
import junit.framework.TestCase;
import org.agilewiki.jactor.*;
import org.agilewiki.jactor.lpc.JLPCActor;
+import org.agilewiki.jactor.JAFuture;
+import org.agilewiki.jactor.JAMailboxFactory;
+import org.agilewiki.jactor.MailboxFactory;
+import org.agilewiki.jactor.RP;
/**
* Test code.

0 comments on commit 2047399

Please sign in to comment.