jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cyberw <lars.holmb...@redshirt.se>
Subject Re: how to Set Load Time programmaticly via Beanshell?
Date Tue, 07 Jan 2014 16:22:47 GMT
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


Mime
View raw message