You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Andrej van der Zee <an...@gmail.com> on 2011/07/14 01:43:50 UTC

Epoch-timestamp in HTTP sampler

Hi,

I need a efficient way to get an approximation of the current time in
all HTTP samplers as I need to send it as a parameter to the server.
What would be the cheapest way in terms of system resources on the
JMeter client machine to get the current Epoch time in every HTTP
sampler?

Thank you,
Andrej

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


Re: Epoch-timestamp in HTTP sampler

Posted by Andrej van der Zee <an...@gmail.com>.
> If you think your custom function(s) would be useful to other users,
> perhaps you could consider creating a Bugzilla enhancement issue with
> the details?
>
> For example, it might make more sense to extend the __time() function
> rather than creating a new function class.

https://issues.apache.org/bugzilla/show_bug.cgi?id=51527

Cheers,
Andrej

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


Re: Epoch-timestamp in HTTP sampler

Posted by sebb <se...@gmail.com>.
On 14 July 2011 04:02, Andrej van der Zee <an...@gmail.com> wrote:
>> Sorry thats what I called it .
>> http://gabenell.blogspot.com/2010/01/custom-functions-for-jmeter.html
>
> Thank you, got it working now. Now I can add more functions to JMeter
> without starting interpreters all the time :) I am learning...

If you think your custom function(s) would be useful to other users,
perhaps you could consider creating a Bugzilla enhancement issue with
the details?

For example, it might make more sense to extend the __time() function
rather than creating a new function class.

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

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


Re: Epoch-timestamp in HTTP sampler

Posted by Andrej van der Zee <an...@gmail.com>.
> Sorry thats what I called it .
> http://gabenell.blogspot.com/2010/01/custom-functions-for-jmeter.html

Thank you, got it working now. Now I can add more functions to JMeter
without starting interpreters all the time :) I am learning...

Cheers,
Andrej

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


Re: Epoch-timestamp in HTTP sampler

Posted by Deepak Shetty <sh...@gmail.com>.
> ${__javaScript(Math.round(new Date().getTime() / 1000))}
Needs a javascript interpreter. Whether it is good enough for you is
something that you can measure and say.

>a native custom function
Sorry thats what I called it .
http://gabenell.blogspot.com/2010/01/custom-functions-for-jmeter.html

regards
deepak

On Wed, Jul 13, 2011 at 6:39 PM, Andrej van der Zee <
andrejvanderzee@gmail.com> wrote:

> > I would guess that the most efficient way would be to write a native
> custom
> > function to give you epoch time (similar to existing __time assumng that
> the
> > current values returned by __time dont work for you since you mention it
> as
> > epoch).
>
> Epoch indeed. Sorry for my lack of JMeter-termonology, but what do you
> mean with a native custom function?
>
> Would this be very inefficient:
> ${__javaScript(Math.round(new Date().getTime() / 1000))}
>
> Cheers,
> Andrej
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Epoch-timestamp in HTTP sampler

Posted by Andrej van der Zee <an...@gmail.com>.
> I would guess that the most efficient way would be to write a native custom
> function to give you epoch time (similar to existing __time assumng that the
> current values returned by __time dont work for you since you mention it as
> epoch).

Epoch indeed. Sorry for my lack of JMeter-termonology, but what do you
mean with a native custom function?

Would this be very inefficient:
${__javaScript(Math.round(new Date().getTime() / 1000))}

Cheers,
Andrej

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


Re: Epoch-timestamp in HTTP sampler

Posted by Deepak Shetty <sh...@gmail.com>.
I would guess that the most efficient way would be to write a native custom
function to give you epoch time (similar to existing __time assumng that the
current values returned by __time dont work for you since you mention it as
epoch).

regards
deepak



On Wed, Jul 13, 2011 at 4:43 PM, Andrej van der Zee <
andrejvanderzee@gmail.com> wrote:

> Hi,
>
> I need a efficient way to get an approximation of the current time in
> all HTTP samplers as I need to send it as a parameter to the server.
> What would be the cheapest way in terms of system resources on the
> JMeter client machine to get the current Epoch time in every HTTP
> sampler?
>
> Thank you,
> Andrej
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>