Why don't you like setBytes()
t method? As per the JavaDoc:
public void setBytes(long length)
In the event the sampler does want to pass back the actual contents, we still want to calculate the throughput. The bytes are the bytes of the response data.
Parameters:
length - the number of bytes of the response data for this sample
I assume you're familiar with the How to Write a plugin for JMeter guide
Personally I am not a big fan of developing "samplers" as in 99.9% of cases the same can be implemented using JSR223 Test Elements and Groovy language, this way you won't have to spend additional time and effort for developing, supporting and troubleshooting the plugin as you can skip such phases as compilation, packaging, adding the new class to JMeter Classpath, restarting JMeter, etc. so JSR223 way is much faster and more convenient as you can develop the code directly in JMeter GUI.
public int getBytes()
? – NaveenKumar NamachivayamgetBytesAsLong()
should work for you (getBytes()
is actually depricated), but not sure what your previous comment means – Kiril S.