Mercurial > stress-tester
changeset 552:8324c4591ad2
client/emiter - request start timestamp taken closer to actual I/O
author | Devel 1 |
---|---|
date | Mon, 18 Sep 2017 12:11:58 +0200 |
parents | c9a1b0be46ef |
children | 80af3ca1b618 |
files | stress-tester/src/main/java/com/passus/st/client/http/HttpFlowBasedClientWorker.java stress-tester/src/main/java/com/passus/st/emitter/EmitterHandler.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java |
diffstat | 3 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpFlowBasedClientWorker.java Mon Sep 18 11:11:26 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpFlowBasedClientWorker.java Mon Sep 18 12:11:58 2017 +0200 @@ -495,6 +495,18 @@ } @Override + public void dataWriteStart(ChannelContext context) { + synchronized (lock) { + HttpFlowContext flowContext = flowContext(context); + if (flowContext != null && flowContext.sentEvent != null) { + long now = timeGenerator.currentTimeMillis(); + flowContext.sendStartTimestamp = now; + flowContext.sentEvent.getRequest().setTag(TAG_TIME_START, now); + } + } + } + + @Override public void dataWritten(ChannelContext context) throws Exception { synchronized (lock) { HttpFlowContext flowContext = flowContext(context); @@ -529,7 +541,7 @@ lock.notifyAll(); } } - + protected boolean send(HttpFlowContext context, HttpSessionPayloadEvent event) { synchronized (lock) { if (event.getRequest() != null) { @@ -554,9 +566,6 @@ } try { - long now = timeGenerator.currentTimeMillis(); - req.setTag(TAG_TIME_START, now); - context.sendStartTimestamp = now; changeFlowState(context, HttpFlowContext.STATE_REQ_SENT); context.sentEvent = event;
--- a/stress-tester/src/main/java/com/passus/st/emitter/EmitterHandler.java Mon Sep 18 11:11:26 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/EmitterHandler.java Mon Sep 18 12:11:58 2017 +0200 @@ -27,6 +27,10 @@ public default void dataReceived(ChannelContext context, ByteBuff data) throws Exception { } + public default void dataWriteStart(ChannelContext context) { + + } + public default void dataWritten(ChannelContext context) throws Exception { }
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java Mon Sep 18 11:11:26 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java Mon Sep 18 12:11:58 2017 +0200 @@ -273,6 +273,7 @@ keyContext.channelContext.getLocalAddress(), keyContext.channelContext.getRemoteAddress()); } + keyContext.handler.dataWriteStart(keyContext.channelContext); Queue<ByteBuffer> queue = keyContext.channelContext.dataQueue(); int written = 0; try {