On Fri, 2018-04-20 at 11:09 +0200, Philippe Mouawad wrote:
> Hello ,
> 
> In current Live version of JMeter we use this way of computing size
> of
> responses for each request:
> 
>    -
>    https://github.com/apache/jmeter/blob/v4_0/src/protocol/http/org/a
> pache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L888
> 
> 
> As we migrated to last APIs we based implementation on this SO
> response
> from Oleg:
> 
>    -
>    https://stackoverflow.com/questions/26166469/measure-bandwidth-usa
> ge-with-apache-httpcomponents-httpclient
> 
> And ended up with this:
> 
>    -
>    https://github.com/apache/jmeter/blob/trunk/src/protocol/http/org/
> apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L382
> 
> But it appears that computation is wrong and we would need to do this
> to be
> correct:
> 
>         protected HttpResponse doReceiveResponse(
>                 final HttpRequest request,
>                 final HttpClientConnection conn,
>                 final HttpContext context) throws HttpException,
> IOException {
>             HttpResponse response = super.doReceiveResponse(request,
> conn,
> context);
>             HttpConnectionMetrics metrics = conn.getMetrics();
>             HttpEntity entity = response.getEntity();
>             context.setAttribute(CONTEXT_ATTRIBUTE_RECEIVED_BYTES,
>                     metrics.getReceivedBytesCount()+
>                     (entity != null ? entity.getContentLength():
> 0L));
>             metrics.reset();
>             return response;
>         }
> 

Philippe

Are you trying to calculate the size of an entire response (message
head + message entity body) or a response entity only?

Oleg

> 
> Is my understanding correct ? or am I missing something ?
> 
> Thanks
> 
> Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to