jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin D. Wilson" <rwils...@gmail.com>
Subject RE: How best to track start & end times during a test?
Date Thu, 03 Nov 2011 23:41:51 GMT
Thanks to the input, I have devised a way to make this work in a 'Summary Report' listener...
It's not pretty, but it is functional.

I've included the contents of my 'TG Timer' here. It uses a separate thread group for the
timers, because the 'once only' controller ran once per thread, not once per thread group.

The general idea is setup some variables, poke them into parameters (so I can transfer the
values across thread groups) and then read and reset them between each thread group - outputting
a dummy sampler line with the timestamp (in ms-since-epoch, but you could change this if you
like) and the elapsed time since the last time the 'TG Timer' ran... I intersperse these TG
Timers between my sequentially running thread groups and "tah dah!" I get timestamps and elapsed
times output in the Summary Report.

------------------------------CUT HERE------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.1">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="TG Timer Config" enabled="true">
      <stringProp name="TestPlan.comments">&apos;Disable&apos; the thread groups
you aren&apos;t trying to stress.</stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel"
testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
      <collectionProp name="TestPlan.thread_groups"/>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Start TG
Timer" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1320342967000</longProp>
        <longProp name="ThreadGroup.end_time">1320342967000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="User
Parameters" enabled="true">
          <collectionProp name="UserParameters.names">
            <stringProp name="1185546556">PrevStartTime</stringProp>
            <stringProp name="-1987142487">PrevTGCount</stringProp>
            <stringProp name="0"></stringProp>
            <stringProp name="1182835273">ElapsedTime</stringProp>
            <stringProp name="-1999321243">threadStartTime</stringProp>
            <stringProp name="-1409654180">tgCount</stringProp>
            <stringProp name="1984987727">setTime</stringProp>
            <stringProp name="647878586">setTGCount</stringProp>
          </collectionProp>
          <collectionProp name="UserParameters.thread_values">
            <collectionProp name="-1834623057">
              <stringProp name="-2078679218">${__P(ThreadStartTime,0)}</stringProp>
              <stringProp name="46204838">${__P(TGCount,1)}</stringProp>
              <stringProp name="0"></stringProp>
              <stringProp name="48">0</stringProp>
              <stringProp name="1008029728">${__javaScript(var ms = new Date; ms.getTime();)}</stringProp>
              <stringProp name="49">1</stringProp>
              <stringProp name="1759500564">${__setProperty(ThreadStartTime, ${threadStartTime})}</stringProp>
              <stringProp name="-1525630572">${__setProperty(TGCount, ${tgCount})}</stringProp>
            </collectionProp>
          </collectionProp>
          <boolProp name="UserParameters.per_iteration">false</boolProp>
        </UserParameters>
        <hashTree/>
        <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="TG ${tgCount}
Start: ${threadStartTime} - Elapsed: ${ElapsedTime}" enabled="true">
          <boolProp name="displayJMeterProperties">false</boolProp>
          <boolProp name="displayJMeterVariables">false</boolProp>
          <boolProp name="displaySystemProperties">false</boolProp>
        </DebugSampler>
        <hashTree/>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG Timer"
enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1320342967000</longProp>
        <longProp name="ThreadGroup.end_time">1320342967000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="User
Parameters" enabled="true">
          <collectionProp name="UserParameters.names">
            <stringProp name="1185546556">PrevStartTime</stringProp>
            <stringProp name="-1987142487">PrevTGCount</stringProp>
            <stringProp name="0"></stringProp>
            <stringProp name="1182835273">ElapsedTime</stringProp>
            <stringProp name="-1999321243">threadStartTime</stringProp>
            <stringProp name="-1409654180">tgCount</stringProp>
            <stringProp name="1984987727">setTime</stringProp>
            <stringProp name="647878586">setTGCount</stringProp>
          </collectionProp>
          <collectionProp name="UserParameters.thread_values">
            <collectionProp name="-1451951225">
              <stringProp name="-2078679218">${__P(ThreadStartTime,0)}</stringProp>
              <stringProp name="46204838">${__P(TGCount,1)}</stringProp>
              <stringProp name="0"></stringProp>
              <stringProp name="-1898455245">${__javaScript(var ms = new Date; ms.getTime()
- ${PrevStartTime};)}</stringProp>
              <stringProp name="1008029728">${__javaScript(var ms = new Date; ms.getTime();)}</stringProp>
              <stringProp name="-1527117377">${__javaScript(${PrevTGCount} + 1)}</stringProp>
              <stringProp name="1759500564">${__setProperty(ThreadStartTime, ${threadStartTime})}</stringProp>
              <stringProp name="-1525630572">${__setProperty(TGCount, ${tgCount})}</stringProp>
            </collectionProp>
          </collectionProp>
          <boolProp name="UserParameters.per_iteration">false</boolProp>
        </UserParameters>
        <hashTree/>
        <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="TG ${tgCount}
Start: ${threadStartTime} - Elapsed: ${ElapsedTime}" enabled="true">
          <boolProp name="displayJMeterProperties">false</boolProp>
          <boolProp name="displayJMeterVariables">false</boolProp>
          <boolProp name="displaySystemProperties">false</boolProp>
        </DebugSampler>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
------------------------------CUT HERE------------------------------
--
Robin D. Wilson


-----Original Message-----
From: Adrian Speteanu [mailto:asp.adieu@gmail.com] 
Sent: Thursday, November 03, 2011 12:45 PM
To: JMeter Users List
Subject: Re: How best to track start & end times during a test?

Hi Robert,

You should take a look at JMeter plugins out there. Some of them give the possibility to switch
between relative time (moment 0 - time elapsed) or actual time (time of start - time of last
sample).

--
Adrian S

On Thu, Nov 3, 2011 at 5:05 PM, Robin D. Wilson <rwilson2@gmail.com> wrote:

> I would find it quite useful to see this sort of information on the 
> listeners too in the GUI...
>
> Specifically, I'd like to see execution 'start' and 'end' times, and 
> even thread 'start' and 'end' times. Ideally we'd have the option to 
> see an 'elapsed' time for the test and the threads as well... Some 
> sort of update to the Summary listener would be ideal.
>
> --
> Robin D. Wilson
>
>
> -----Original Message-----
> From: ZK [mailto:stevesenior69@gmail.com]
> Sent: Thursday, November 03, 2011 2:43 AM
> To: jmeter-user@jakarta.apache.org
> Subject: Re: How best to track start & end times during a test?
>
> You could add this to a  'debug sampler' name; inside a 'once only
> controller':
>  [Date=${__time("dd-MM-yyyy",today)}] [Time=${__time("hh:mm",today)}]
>
>
> This would give you the start date and time for your test
>
>
>
>
> ZK
>
> --
> View this message in context:
>
> http://jmeter.512774.n5.nabble.com/How-best-to-track-start-end-times-d
> uring-
> a-test-tp4959871p4960358.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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>


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


Mime
View raw message