changeset 1299:c662aced580e

stress-tester-benchmark: compilation fixed, SerializationTest bugfix
author Devel 1
date Thu, 20 Aug 2020 14:42:42 +0200
parents 90ce0004c15f
children 3b136c4c1ae3
files stress-tester-benchmark/pom.xml stress-tester-benchmark/src/main/java/com/passus/data/DataProcessorChainBenchmark.java stress-tester-benchmark/src/main/java/com/passus/http/HttpUtilsBenchmark.java stress-tester-benchmark/src/main/java/com/passus/java/CallBenchmark.java stress-tester-benchmark/src/main/java/com/passus/java/CallbackBenchmark.java stress-tester-benchmark/src/main/java/com/passus/java/MakeByteArray.java stress-tester-benchmark/src/main/java/com/passus/serializer/SerializationTest.java stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractHttpMessagePredicateBenchmark.java stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractValueExtractorBenchmark.java
diffstat 9 files changed, 33 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-benchmark/pom.xml	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/pom.xml	Thu Aug 20 14:42:42 2020 +0200
@@ -105,7 +105,13 @@
             <artifactId>pcap</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
-        
+
+        <dependency>
+            <groupId>com.passus</groupId>
+            <artifactId>native-test</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
         <dependency>
             <groupId>org.brotli</groupId>
             <artifactId>dec</artifactId>
--- a/stress-tester-benchmark/src/main/java/com/passus/data/DataProcessorChainBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/data/DataProcessorChainBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -44,7 +44,7 @@
 
     private final ByteBuff in;
 
-    private final PooledAllocator pooledAllocator = new PooledAllocator(dataSize * 2, 4, 0);
+    private final PooledByteBuffAllocator pooledAllocator = new PooledByteBuffAllocator(dataSize * 2, 4, 0);
 
     private ByteBuff out = new HeapByteBuff(data.length * 2);
 
@@ -63,7 +63,7 @@
         }
     }
 
-    private DataProcessorChain prepareChain(Allocator allocator) {
+    private DataProcessorChain prepareChain(ByteBuffAllocator allocator) {
         GZIPDecompressionProcessor gzipProc = new GZIPDecompressionProcessor();
         GZIPDecompressionProcessor gzipProc2 = new GZIPDecompressionProcessor();
         InflaterProcessor inflaterProcessor = new InflaterProcessor();
--- a/stress-tester-benchmark/src/main/java/com/passus/http/HttpUtilsBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/http/HttpUtilsBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -1,6 +1,6 @@
 package com.passus.http;
 
-import com.passus.commons.AsciiUtils;
+import com.passus.commons.utils.AsciiUtils;
 import java.util.concurrent.TimeUnit;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
--- a/stress-tester-benchmark/src/main/java/com/passus/java/CallBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/java/CallBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -1,6 +1,6 @@
 package com.passus.java;
 
-import com.passus.pcap.CallTest;
+import com.passus.test.CallTest;
 import java.util.concurrent.TimeUnit;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
--- a/stress-tester-benchmark/src/main/java/com/passus/java/CallbackBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/java/CallbackBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -1,6 +1,6 @@
 package com.passus.java;
 
-import com.passus.pcap.CallBack;
+import com.passus.test.CallBack;
 import java.util.concurrent.TimeUnit;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
--- a/stress-tester-benchmark/src/main/java/com/passus/java/MakeByteArray.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/java/MakeByteArray.java	Thu Aug 20 14:42:42 2020 +0200
@@ -1,7 +1,7 @@
 package com.passus.java;
 
-import com.passus.pcap.CallTest;
-import com.passus.pcap.PacketHandler;
+import com.passus.test.ByteArrayHandler;
+import com.passus.test.CallTest;
 import java.util.concurrent.TimeUnit;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -36,9 +36,9 @@
     @Param({"160", "1600", "16000"})
     int size = 160;
 
-    private PacketHandler handler = new PacketHandler() {
+    private final ByteArrayHandler handler = new ByteArrayHandler() {
         @Override
-        public void handle(byte[] ba, long timestamp, int wirelen) {
+        public void handle(byte[] ba) {
         }
     };
 
--- a/stress-tester-benchmark/src/main/java/com/passus/serializer/SerializationTest.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/serializer/SerializationTest.java	Thu Aug 20 14:42:42 2020 +0200
@@ -80,7 +80,7 @@
         GenericRecord request = new GenericData.Record(schema3);
         request.put("method", method);
         request.put("url", bean.getRequest().getUrl());
-        request.put("version", bean.getRequest().getUrl());
+        request.put("version", bean.getRequest().getVersion());
 
         GenericRecord record = new GenericData.Record(schema2);
         record.put("fields", bean.getFields());
@@ -185,16 +185,20 @@
 
     public static void printSerializedSize() throws IOException {
         SerializationTest test = new SerializationTest();
-        System.out.println("avro generic:  " + test.testAvroGeneric().length);
-        System.out.println("avro reflect:  " + test.testAvroReflect().length);
-        System.out.println("avro specific: " + test.testAvroSpecific().length);
-        System.out.println("kryo:          " + test.testKryo().length);
-        System.out.println("kryo whole:    " + test.testKryoWholeBean().length);
-        System.out.println("kryo serializ: " + test.testKryoSerializer1().length);
-        System.out.println("kryo serializ: " + test.testKryoSerializer2().length);
-        System.out.println("bson:          " + test.testBson().length);
-        System.out.println("externalizable:" + test.testExternalizable().length);
-        System.out.println("TCP payload:   " + PAYLOAD.length);
+        printEntry("avro generic:  ", test.testAvroGeneric());
+        printEntry("avro reflect:  ", test.testAvroReflect());
+        printEntry("avro specific: ", test.testAvroSpecific());
+        printEntry("kryo:          ", test.testKryo());
+        printEntry("kryo whole:    ", test.testKryoWholeBean());
+        printEntry("kryo serializ: ", test.testKryoSerializer1());
+        printEntry("kryo serializ: ", test.testKryoSerializer2());
+        printEntry("bson:          ", test.testBson());
+        printEntry("externalizable:", test.testExternalizable());
+        printEntry("TCP payload:   ", PAYLOAD);
+    }
+    
+    private static void printEntry(String name, byte[] value) {
+        System.out.println(name + value.length/* + " " + new String(value)*/);
     }
 
     @Benchmark
--- a/stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractHttpMessagePredicateBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractHttpMessagePredicateBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -33,7 +33,7 @@
     private final HttpRequest req = HttpRequestBuilder.get("http://test.com/logout")
             .tag(TAG_SESSION_ID, "sid1").cookie("abc", "def").build();
     private final HttpResponse resp = HttpResponseBuilder.ok().header("abc", "def").build();
-    private final HttpMessageWrapper wrapper = new HttpMessageWrapper(req, resp, null);
+    private final HttpMessageWrapper wrapper = new HttpMessageWrapper(new HttpFilterRequestWrapper(req), new HttpFilterResponseWrapper(resp), null, null, null);
 
     public abstract Predicate predicate(String config);
 
--- a/stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractValueExtractorBenchmark.java	Thu Aug 13 16:15:41 2020 +0200
+++ b/stress-tester-benchmark/src/main/java/com/passus/st/client/http/filter/AbstractValueExtractorBenchmark.java	Thu Aug 20 14:42:42 2020 +0200
@@ -34,7 +34,7 @@
     private final HttpRequest req = HttpRequestBuilder.get("http://test.com/logout")
             .cookie("abc", "def").tag(TAG_SESSION_ID, "sid").build();
     private final HttpResponse resp = HttpResponseBuilder.ok().header("Content-Type", "binary").build();
-    private final HttpMessageWrapper wrapper = new HttpMessageWrapper(req, resp, null);
+    private final HttpMessageWrapper wrapper = new HttpMessageWrapper(new HttpFilterRequestWrapper(req), new HttpFilterResponseWrapper(resp), null, null, null);
 
     public abstract ValueExtractor extractor(String expr);