On 31 January 2013 18:47, sebb <[email protected]> wrote: > 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.
I forgot to say - if you just want a way to add information to the sample results (JTL) file, then of course you can store the information as text in the response field. Or you can store the values in variables, and tell JMeter to write the variables to the JTL file. http://jmeter.apache.org/usermanual/listeners.html#sample_variables The sample result will still have the elapsed times from the sampler itself, which are probably not all that useful. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
