changeset 1272:4727d5e344f1

FlowMetric - "responseSizeDist" metric fixed
author Devel 2
date Fri, 03 Jul 2020 13:59:20 +0200
parents b51cb6766ca6
children ea44baa39214
files stress-tester/src/main/java/com/passus/st/client/FlowContext.java stress-tester/src/main/java/com/passus/st/client/FlowMetric.java stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowContext.java	Fri Jul 03 11:36:39 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowContext.java	Fri Jul 03 13:59:20 2020 +0200
@@ -52,6 +52,8 @@
 
     protected long receivedStartTime = -1;
 
+    protected int receivedSize = 0;
+
     protected int loop;
 
     protected FlowHandler flowHandler;
--- a/stress-tester/src/main/java/com/passus/st/client/FlowMetric.java	Fri Jul 03 11:36:39 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowMetric.java	Fri Jul 03 13:59:20 2020 +0200
@@ -90,6 +90,10 @@
         responseReceivingTimeHistogram.update(time);
     }
 
+    public void addResponseSize(int size) {
+        responseSizeHistogram.update(size);
+    }
+
     @Override
     protected void doActivate() {
         responseReceivingTimeHistogram.activate();
--- a/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java	Fri Jul 03 11:36:39 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java	Fri Jul 03 13:59:20 2020 +0200
@@ -381,6 +381,7 @@
                     flowContext.sentEvent = event;
                     flowContext.writeStartTime = -1;
                     flowContext.writeEndTime = -1;
+                    flowContext.receivedSize = 0;
                     flowContext.channelContext().writeAndFlush(buffer);
                     requestSent0(flowContext, event);
 
@@ -419,6 +420,7 @@
         }
         flowContext.sentEvent = null;
         flowContext.receivedStartTime = -1;
+        flowContext.receivedSize = 0;
     }
 
     @Override
@@ -437,6 +439,7 @@
 
                 if (res > 0) {
                     data.skipBytes(res);
+                    flowContext.receivedSize += res;
                 }
 
                 long now = System.currentTimeMillis();
@@ -464,6 +467,7 @@
                         synchronized (metric) {
                             metric.incResponsesNum();
                             metric.addResponseReceivingTime(now - flowContext.receivedStartTimestamp());
+                            metric.addResponseSize(flowContext.receivedSize);
                         }
                     }