On 31 January 2013 17:30, Marcelo Jara <[email protected]> wrote:
> I am trying something out. Let me know if it makes sense.
> I wrote a groovy script that will get certain values from a server via JMX. 
> For example, I am getting heap used, thread count, class count, and CPU. I am 
> currently writing this data to a file and can process it at the end of the 
> test.
> However, I was thinking it may be worthwhile trying to create a sample called 
> "CPU" and have it's elapsed/latency time set to the CPU value. This way, CPU 
> is treated like any other sampler and we can see CPU over time.
> What I have so far is a JSR223 Sampler with the groovy script. I then have a 
> BeanShell PostProcessor. In the BeanShell script, I can set the label and 
> latency using:
> prev.setSampleLabel("CPU");prev.setLatency(19);  //the value is hardcoded for 
> now
> This works, but now I am trying to set the elapsed time as well. I tried 
> prev.setStampAndTime, but that is not working.
> ts = System.currentTimeMillis();prev.setStampAndTime(ts,19);
>
> Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error 
> invoking bsh method: eval    Sourced file: inline evaluation of: 
> ``prev.setSampleLabel("CPU"); ts = System.currentTimeMillis(); 
> prev.setStampAndTim . . . '' : Method Invocation prev.setStampAndTime
>

The elapsed time is special: it's set using sampleStart() sampleEnd().

There are various checks to make sure that the times don't get
accidentally updated.

Sorry, but It's not possible to set a specific elapsed time from a sampler.

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

Reply via email to