summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@adonis.matthew.ath.cx>2007-10-25 14:14:33 +0100
committerMatthew Johnson <mjj29@adonis.matthew.ath.cx>2007-10-25 14:14:33 +0100
commitf3b7f95b313ad3f5c00d343438a19bf78d190bff (patch)
tree44a6963ea0e43df48fb6b1b4340aef49b36c5ba2
parentb3d5aeedc9a34b86eebcca92c2998c39e7ce3dbb (diff)
profile rate add;
* Make Marshalling more verbose and descriptive in the presence of mismatched parameter lists (suggested by Anibal Sanchez <anibal -dot- sanchez -at- sunya -dot- com -dot- ar>)
-rw-r--r--Makefile16
-rw-r--r--changelog5
-rw-r--r--org/freedesktop/dbus/Marshalling.java11
-rw-r--r--org/freedesktop/dbus/MethodCall.java4
-rw-r--r--org/freedesktop/dbus/test/Profiler.java1
-rw-r--r--org/freedesktop/dbus/test/ProfilerInstance.java1
-rw-r--r--org/freedesktop/dbus/test/profile.java45
7 files changed, 72 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 9d4d256..bd9ab82 100644
--- a/Makefile
+++ b/Makefile
@@ -181,7 +181,7 @@ check: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDae
testbin/DBusDaemon --addressfile address --pidfile pid 2> server.log&\
sleep 1; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- if $(MAKE) DBUS_JAVA_FLOATS=true testrun 2> client.log; then export PASS=true; fi ; \
+ if $(MAKE) DBUS_JAVA_FLOATS=true DEBUG=$(DEBUG) testrun 2> client.log; then export PASS=true; fi ; \
kill $$(cat pid) ; \
if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi )
@@ -191,23 +191,23 @@ internal-cross-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar t
( testbin/DBusDaemon --addressfile address --pidfile pid &\
sleep 1; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- $(MAKE) DBUS_JAVA_FLOATS=true -s cross-test-server | tee server.log &\
+ $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s cross-test-server | tee server.log &\
sleep 1;\
- $(MAKE) DBUS_JAVA_FLOATS=true -s cross-test-client | tee client.log ;\
+ $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s cross-test-client | tee client.log ;\
kill $$(cat pid) ; )
peer-to-peer-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar
- ( $(MAKE) DBUS_JAVA_FLOATS=true -s peer-server 2>&1 | tee server.log &\
+ ( $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s peer-server 2>&1 | tee server.log &\
sleep 1;\
- $(MAKE) DBUS_JAVA_FLOATS=true -s peer-client 2>&1 | tee client.log )
+ $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s peer-client 2>&1 | tee client.log )
two-part-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar
( testbin/DBusDaemon --addressfile address --pidfile pid &\
sleep 1; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- $(MAKE) DBUS_JAVA_FLOATS=true -s two-part-server | tee server.log &\
+ $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s two-part-server | tee server.log &\
sleep 1;\
- $(MAKE) DBUS_JAVA_FLOATS=true -s two-part-client | tee client.log ;\
+ $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s two-part-client | tee client.log ;\
kill $$(cat pid) ; )
profile: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar
@@ -215,7 +215,7 @@ profile: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusD
testbin/DBusDaemon --addressfile address --pidfile pid &\
sleep 1; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- if $(MAKE) DBUS_JAVA_FLOATS=true profilerun ; then export PASS=true; fi ; \
+ if $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true profilerun ; then export PASS=true; fi ; \
kill $$(cat pid) ; \
if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi )
diff --git a/changelog b/changelog
index 1967d6c..22ffa65 100644
--- a/changelog
+++ b/changelog
@@ -5,11 +5,14 @@ Version 2.3.2:
* Add licence headers to files missing them
* Fix minor bug in AbstractConnection.java (reported by Frank Benoit
<benoit -at- tionex -dot- de>
+ * Make Marshalling more verbose and descriptive in the presence of
+ mismatched parameter lists (suggested by Anibal Sanchez
+ <anibal -dot- sanchez -at- sunya -dot- com -dot- ar>)
Version 2.3.1:
* Fix regression in normal array handling (spotted by Anibal Sanchez
- <anibal -dot- sanchez -at- sunya -dot- com -dot- ar>
+ <anibal -dot- sanchez -at- sunya -dot- com -dot- ar>)
Version 2.3:
diff --git a/org/freedesktop/dbus/Marshalling.java b/org/freedesktop/dbus/Marshalling.java
index e7e3a82..9c75275 100644
--- a/org/freedesktop/dbus/Marshalling.java
+++ b/org/freedesktop/dbus/Marshalling.java
@@ -554,6 +554,17 @@ public class Marshalling
{
if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserializing from "+parameters+" to "+types);
if (null == parameters) return null;
+
+ // CHECK IF ARRAYS HAVE THE SAME LENGTH
+ if (types.length != parameters.length) {
+ if (Debug.debug) {
+ for (int i = 0; i < parameters.length; i++) {
+ Debug.print(Debug.ERR, String.format("Error, Parameters difference (%1d, '%2s')", i, parameters[i].toString()));
+ }
+ }
+ throw new DBusException("Error deserializing message: number parameters didn't match receiving signature");
+ }
+
for (int i = 0; i < parameters.length; i++) {
if (null == parameters[i]) continue;
diff --git a/org/freedesktop/dbus/MethodCall.java b/org/freedesktop/dbus/MethodCall.java
index b21bb7d..40a5712 100644
--- a/org/freedesktop/dbus/MethodCall.java
+++ b/org/freedesktop/dbus/MethodCall.java
@@ -75,9 +75,9 @@ public class MethodCall extends Message
/**
* Set the default timeout for method calls.
* Default is 20s.
- * @param New timeout in ms.
+ * @param timeout New timeout in ms.
*/
- public static setDefaultTimeout(long timeout)
+ public static void setDefaultTimeout(long timeout)
{
REPLY_WAIT_TIMEOUT = timeout;
}
diff --git a/org/freedesktop/dbus/test/Profiler.java b/org/freedesktop/dbus/test/Profiler.java
index 164b936..155811c 100644
--- a/org/freedesktop/dbus/test/Profiler.java
+++ b/org/freedesktop/dbus/test/Profiler.java
@@ -30,6 +30,7 @@ public interface Profiler extends DBusInterface
public void list(List<String> l);
public void bytes(byte[] b);
public void struct(ProfileStruct ps);
+ public void string(String s);
}
diff --git a/org/freedesktop/dbus/test/ProfilerInstance.java b/org/freedesktop/dbus/test/ProfilerInstance.java
index 3b46800..790f73a 100644
--- a/org/freedesktop/dbus/test/ProfilerInstance.java
+++ b/org/freedesktop/dbus/test/ProfilerInstance.java
@@ -21,4 +21,5 @@ public class ProfilerInstance implements Profiler
public void list(List<String> l) { return; }
public void bytes(byte[] b) { return; }
public void struct(ProfileStruct ps) { return; }
+ public void string(String s) { return; }
}
diff --git a/org/freedesktop/dbus/test/profile.java b/org/freedesktop/dbus/test/profile.java
index e25db33..5a383d3 100644
--- a/org/freedesktop/dbus/test/profile.java
+++ b/org/freedesktop/dbus/test/profile.java
@@ -254,6 +254,51 @@ public class profile
long t = System.currentTimeMillis();
p.bytes(bs);
System.out.println(" done in "+(System.currentTimeMillis()-t)+"ms.");
+ } else if ("rate".equals(args[0])) {
+ conn.exportObject("/Profiler", new ProfilerInstance());
+ Profiler p = (Profiler) conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class);
+ Peer peer = (Peer) conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class);
+ long start = System.currentTimeMillis();
+ int count = 0;
+ do {
+ peer.Ping();
+ count++;
+ } while(count < 10000);
+ long end = System.currentTimeMillis();
+ System.out.println("No payload: "+((count*1000)/(end-start))+" RT/second");
+ int len = 256;
+ while (len <= 32768) {
+ byte[] bs = new byte[len];
+ count = 0;
+ start = System.currentTimeMillis();
+ do {
+ p.bytes(bs);
+ count++;
+ } while(count < 1000);
+ end = System.currentTimeMillis();
+ long ms = end-start;
+ double cps = (count*1000)/ms;
+ double rate = (len*cps)/(1024.0*1024.0);
+ System.out.println(len+" byte array) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s");
+ len <<= 1;
+ }
+ len = 256;
+ while (len <= 32768) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < len; i++) sb.append('a');
+ String s = sb.toString();
+ end = System.currentTimeMillis()+500;
+ count = 0;
+ do {
+ p.string(s);
+ count++;
+ } while(count < 1000);
+ long ms = end-start;
+ double cps = (count*1000)/ms;
+ double rate = (len*cps)/(1024.0*1024.0);
+ System.out.println(len+" string) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s");
+ len <<= 1;
+ }
} else if ("signals".equals(args[0])) {
int count = SIGNAL_OUTER*SIGNAL_INNER;
System.out.print("Sending "+count+" signals");