[logback-dev] svn commit: r1012 - logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net
noreply.seb at qos.ch
noreply.seb at qos.ch
Tue Nov 28 14:35:19 CET 2006
Author: seb
Date: Tue Nov 28 14:35:19 2006
New Revision: 1012
Modified:
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
Log:
minor fixes
Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java (original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java Tue Nov 28 14:35:19 2006
@@ -37,7 +37,10 @@
int pauseCounter = 0;
for (int i = 0; i < loopNumber; i++) {
try {
- oos.writeObject(buildNewAccessEvent());
+ AccessEvent ae = buildNewAccessEvent();
+ //average time for the next method: 5000 nanos
+ ae.prepareForDeferredProcessing();
+ oos.writeObject(ae);
oos.flush();
if (++resetCounter >= resetFrequency) {
oos.reset();
@@ -62,8 +65,11 @@
// System.out.println("Beginning mesured run");
for (int i = 0; i < loopNumber; i++) {
try {
+ AccessEvent ae = buildNewAccessEvent();
t1 = System.nanoTime();
- oos.writeObject(buildNewAccessEvent());
+ //average length of the next method: 4000 nanos
+ ae.prepareForDeferredProcessing();
+ oos.writeObject(ae);
oos.flush();
t2 = System.nanoTime();
total += (t2 - t1);
@@ -79,9 +85,11 @@
fail(ex.getMessage());
}
}
- total /= 1000;
+
+ total /= (1000);//nanos -> micros
System.out.println("Loop done : average time = " + total / loopNumber
+ " microsecs after " + loopNumber + " writes.");
+ //average time: 26-30 microsec = 0.034 milis
}
private AccessEvent buildNewAccessEvent() {
Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java (original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java Tue Nov 28 14:35:19 2006
@@ -43,6 +43,8 @@
assertEquals(1, mockSocketServer.accessEventList.size());
AccessEvent remoteEvent = mockSocketServer.accessEventList.get(0);
+ //check that the values are available although the request and response
+ //objects did not survive serialization
assertEquals("headerValue1", remoteEvent.getRequestHeader("headerName1"));
assertEquals("testHost", remoteEvent.getRemoteHost());
}
More information about the logback-dev
mailing list