You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Rob Schroder <ro...@manilla.com> on 2011/03/09 01:42:29 UTC

Subtracting User Defined Variables

Hi,

I've been beating my head against the wall trying to do something that I thought would be simple.

Problem:

I have a BeanShell processor that grabs the begin time of a sampler at a point in time during the script execution.  I have another BeanShell processor that grabs the end time of a sampler down the road.  The values are stored in ${begin_time} and ${end_time}, respectively.  I'd simply like to get the difference of these two values and store them in a user defined variable that can be written to the summary reports.

Can someone tell me what the best approach is?  My efforts for this seemingly simple operation have all failed :')

-rob

Re: Subtracting User Defined Variables

Posted by Rob Schroder <ro...@manilla.com>.
Thanks, Sebb.  That did the trick.



On 3/8/11 4:45 PM, "sebb" <se...@gmail.com> wrote:

On 9 March 2011 00:42, Rob Schroder <ro...@manilla.com> wrote:
> Hi,
>
> I've been beating my head against the wall trying to do something that I thought would be simple.
>
> Problem:
>
> I have a BeanShell processor that grabs the begin time of a sampler at a point in time during the script execution.  I have another BeanShell processor that grabs the end time of a sampler down the road.  The values are stored in ${begin_time} and ${end_time}, respectively.  I'd simply like to get the difference of these two values and store them in a user defined variable that can be written to the summary reports.
>
> Can someone tell me what the best approach is?  My efforts for this seemingly simple operation have all failed :')

http://jakarta.apache.org/jmeter/usermanual/functions.html#__longSum

${__longSum(${end_time),-${begin_time})}

> -rob
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org



Re: Subtracting User Defined Variables

Posted by sebb <se...@gmail.com>.
On 9 March 2011 00:42, Rob Schroder <ro...@manilla.com> wrote:
> Hi,
>
> I've been beating my head against the wall trying to do something that I thought would be simple.
>
> Problem:
>
> I have a BeanShell processor that grabs the begin time of a sampler at a point in time during the script execution.  I have another BeanShell processor that grabs the end time of a sampler down the road.  The values are stored in ${begin_time} and ${end_time}, respectively.  I'd simply like to get the difference of these two values and store them in a user defined variable that can be written to the summary reports.
>
> Can someone tell me what the best approach is?  My efforts for this seemingly simple operation have all failed :')

http://jakarta.apache.org/jmeter/usermanual/functions.html#__longSum

${__longSum(${end_time),-${begin_time})}

> -rob
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org