You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ma...@kvk.nl on 2011/05/23 10:04:47 UTC
how to Set Load Time programmaticly via Beanshell?
Hello,
I want to create a sampler which I can use to create a graph.
The response times will be based on secondary parameters like
jvmBytesUsed, etc which will be queried by another sampler.
I tried to use a beanshell sampler, but this does add 40-50 miliseconds of
processing time. How can I set the Load Time programmaticly to avoid this?
Kind regards,
Mark Bakker
import org.apache.jmeter.samplers.SampleResult;
SampleResult.sampleEnd();
SampleResult res = new SampleResult(System.currentTimeMillis(), 600);
res.setResponseOK();
SampleResult.addSubResult(res);
return null;
Mark Bakker Kamer van Koophandel Nederland
Test Manager
MID
t
e +31 348 426 911
mark.bakker@kvk.nl
Watermolenlaan 1
Postbus 191
3440 AD Woerden
www.kvk.nl
ma,di,wo,do
Denk aan het milieu. Print deze e-mail alleen als het noodzakelijk is.
Re: Betr.: Re: how to Set Load Time programmaticly via Beanshell?
Posted by apc <ap...@apc.kg>.
Well, you could only plot Latencies Over Time then...
The problem is that you can't set response time directly on SampleResult.
You can do this on sub-samples, calling res.sampleStart(), then
Thread.delay(450); then res.SampleEnd()
This will give you sub-sample with correct response time.
--
View this message in context: http://jmeter.512774.n5.nabble.com/how-to-Set-Load-Time-programmaticly-via-Beanshell-tp4418353p4418451.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Betr.: Re: how to Set Load Time programmaticly via Beanshell?
Posted by ma...@kvk.nl.
Thanx,
But when I try to visualize this I can't see it. I use the extensions from
google code for visualizing the response times.
So I realy would like to set the response times.
Kind regards,
Mark
apc <ap...@apc.kg>
23-05-2011 10:47
Antwoord a.u.b. aan
"JMeter Users List" <jm...@jakarta.apache.org>
Aan
jmeter-user@jakarta.apache.org
Cc
Onderwerp
Re: how to Set Load Time programmaticly via Beanshell?
You could use Latency property of SampleResult to store your value.
SampleResult.setLatency(450);
--
View this message in context:
http://jmeter.512774.n5.nabble.com/how-to-Set-Load-Time-programmaticly-via-Beanshell-tp4418353p4418427.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Mark Bakker Kamer van Koophandel Nederland
Test Manager
MID
t
e +31 348 426 911
mark.bakker@kvk.nl
Watermolenlaan 1
Postbus 191
3440 AD Woerden
www.kvk.nl
ma,di,wo,do
Denk aan het milieu. Print deze e-mail alleen als het noodzakelijk is.
Re: how to Set Load Time programmaticly via Beanshell?
Posted by apc <ap...@apc.kg>.
You could use Latency property of SampleResult to store your value.
SampleResult.setLatency(450);
--
View this message in context: http://jmeter.512774.n5.nabble.com/how-to-Set-Load-Time-programmaticly-via-Beanshell-tp4418353p4418427.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: how to Set Load Time programmaticly via Beanshell?
Posted by cyberw <la...@redshirt.se>.
Hi!
I realize you probably moved on from this ages ago, but I thought I'd offer
my solution if somebody is still interested...
You can use the jmeter-plugins Dummy Sampler and set its response time using
a jmeter variable.
For example, I used this to monitor & plot ping times, by having a dummy
sampler with response time set to ${pingtime}, and a JSR223 PreProcessor
with the following code:
String[] command = { "cmd.exe", "/C", "ping -n 1 myserver.com" };
commandProcess = Runtime.getRuntime().exec(command);
vars.put("pingtime","999999");
BufferedReader buffy = new BufferedReader(new
InputStreamReader(commandProcess.getInputStream()));
String readline;
while((readline = buffy.readLine())!=null) {
int timeIndex = readline.indexOf("time=");
if (timeIndex > 0) {
String time = readline.substring(timeIndex + 5,
readline.indexOf("ms",timeIndex + 5));
// log.info("time: " + time);
vars.put("pingtime",time);
}
}
--
View this message in context: http://jmeter.512774.n5.nabble.com/how-to-Set-Load-Time-programmaticly-via-Beanshell-tp4418353p5719047.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org