Mercurial > stress-tester
changeset 483:0c397865b8f9
PcapSessionEventSourceMetric - counts HttpSessionPayloadEvent
author | Devel 1 |
---|---|
date | Tue, 08 Aug 2017 15:51:19 +0200 |
parents | 92c5b38cc84a |
children | 22e47569bc32 |
files | stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSourceMetric.java |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java Tue Aug 08 14:41:43 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java Tue Aug 08 15:51:19 2017 +0200 @@ -532,6 +532,9 @@ Event event = new HttpSessionPayloadEvent(info, req, (HttpResponse) message); event.setTimestamp(timestamp); eventHandler.handle(event); + if (collectMetric) { + metric.incPayloads(); + } } }
--- a/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSourceMetric.java Tue Aug 08 14:41:43 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSourceMetric.java Tue Aug 08 15:51:19 2017 +0200 @@ -21,8 +21,8 @@ private final String name; private final MutableInt frames = new MutableInt(0); - private final MutableInt tcpPackets = new MutableInt(0); + private final MutableInt payloads = new MutableInt(0); private final Map<String, Serializable> attrs = new LinkedHashMap<>(); @@ -37,7 +37,7 @@ this.name = name; attrs.put("frames", frames); attrs.put("tcpPackets", tcpPackets); - + attrs.put("payloads", payloads); } @Override @@ -73,6 +73,10 @@ tcpPackets.increment(); } + public void incPayloads() { + payloads.increment(); + } + @Override public Class getAttributeClass(String name) { Serializable value = getAttributeValue(name); @@ -107,6 +111,7 @@ public void reset() { frames.setValue(0); tcpPackets.setValue(0); + payloads.setValue(0); } @Override @@ -118,5 +123,6 @@ PcapSessionEventSourceMetric pcapMetric = (PcapSessionEventSourceMetric) metric; frames.add(pcapMetric.frames); tcpPackets.add(pcapMetric.tcpPackets); + payloads.add(pcapMetric.payloads); } }