ctx.getThreadNum() and ${__threadNum}

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

ctx.getThreadNum() and ${__threadNum}

Ivan Rancati-3
Good morning,

I think that ctx.getThreadNum() returns a 0-based thread number, while the
variable __threadNum is 1-based.

I have prepared test plan with a just a thread group, a constant throughput
timer and JSR223 sampler which just logs

log.info("from ctx:"+ctx.getThreadNum())
log.info("from variable: ${__threadNum}")

in jmeter.log I see for example for the first thread

2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started: Thread
Group 1-1
...
2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from variable: 1

and so on. Am I reading incorrectly one of the two values?

I thought, as the threads are numbered with <thread group starting from
1>-<thread number starting from 1>
in jmeter.log, both values should be 1-based

Thanks and best regards,
Ivan
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

Ivan Rancati-3
As JMeter 5.0 has been released today, a quick update:

the behaviour with the thread number is the same with JMeter 4.0 and 5.0. I
tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle JDK
9 and Oracle JDK 10

Thanks for the 5.0 release and best regards

On Wed, Sep 19, 2018 at 8:00 AM Ivan Rancati <[hidden email]> wrote:

> Good morning,
>
> I think that ctx.getThreadNum() returns a 0-based thread number, while the
> variable __threadNum is 1-based.
>
> I have prepared test plan with a just a thread group, a constant
> throughput timer and JSR223 sampler which just logs
>
> log.info("from ctx:"+ctx.getThreadNum())
> log.info("from variable: ${__threadNum}")
>
> in jmeter.log I see for example for the first thread
>
> 2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started: Thread
> Group 1-1
> ...
> 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
> 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from variable: 1
>
> and so on. Am I reading incorrectly one of the two values?
>
> I thought, as the threads are numbered with <thread group starting from
> 1>-<thread number starting from 1>
> in jmeter.log, both values should be 1-based
>
> Thanks and best regards,
> Ivan
>
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

shettyd
I believe there is a discrepancy - The context reads it from the thread
which is 0 based and the other from the name.
Its probably late to change this without potentially breaking backward
compatibility - perhaps a documentation update is better .

regards
deepak

On Wed, Sep 19, 2018 at 12:54 AM Ivan Rancati <[hidden email]>
wrote:

> As JMeter 5.0 has been released today, a quick update:
>
> the behaviour with the thread number is the same with JMeter 4.0 and 5.0. I
> tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle JDK
> 9 and Oracle JDK 10
>
> Thanks for the 5.0 release and best regards
>
> On Wed, Sep 19, 2018 at 8:00 AM Ivan Rancati <[hidden email]>
> wrote:
>
> > Good morning,
> >
> > I think that ctx.getThreadNum() returns a 0-based thread number, while
> the
> > variable __threadNum is 1-based.
> >
> > I have prepared test plan with a just a thread group, a constant
> > throughput timer and JSR223 sampler which just logs
> >
> > log.info("from ctx:"+ctx.getThreadNum())
> > log.info("from variable: ${__threadNum}")
> >
> > in jmeter.log I see for example for the first thread
> >
> > 2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started: Thread
> > Group 1-1
> > ...
> > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
> > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from variable: 1
> >
> > and so on. Am I reading incorrectly one of the two values?
> >
> > I thought, as the threads are numbered with <thread group starting from
> > 1>-<thread number starting from 1>
> > in jmeter.log, both values should be 1-based
> >
> > Thanks and best regards,
> > Ivan
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

Ivan Rancati-3
hello,

I entered a P3/minor bug with the documentation update request
https://bz.apache.org/bugzilla/show_bug.cgi?id=62752

Thanks and best regards
Ivan

On Thu, Sep 20, 2018 at 7:18 PM Deepak Shetty <[hidden email]> wrote:

> I believe there is a discrepancy - The context reads it from the thread
> which is 0 based and the other from the name.
> Its probably late to change this without potentially breaking backward
> compatibility - perhaps a documentation update is better .
>
> regards
> deepak
>
> On Wed, Sep 19, 2018 at 12:54 AM Ivan Rancati <[hidden email]>
> wrote:
>
> > As JMeter 5.0 has been released today, a quick update:
> >
> > the behaviour with the thread number is the same with JMeter 4.0 and
> 5.0. I
> > tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle
> JDK
> > 9 and Oracle JDK 10
> >
> > Thanks for the 5.0 release and best regards
> >
> > On Wed, Sep 19, 2018 at 8:00 AM Ivan Rancati <[hidden email]>
> > wrote:
> >
> > > Good morning,
> > >
> > > I think that ctx.getThreadNum() returns a 0-based thread number, while
> > the
> > > variable __threadNum is 1-based.
> > >
> > > I have prepared test plan with a just a thread group, a constant
> > > throughput timer and JSR223 sampler which just logs
> > >
> > > log.info("from ctx:"+ctx.getThreadNum())
> > > log.info("from variable: ${__threadNum}")
> > >
> > > in jmeter.log I see for example for the first thread
> > >
> > > 2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started:
> Thread
> > > Group 1-1
> > > ...
> > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
> > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from variable:
> 1
> > >
> > > and so on. Am I reading incorrectly one of the two values?
> > >
> > > I thought, as the threads are numbered with <thread group starting from
> > > 1>-<thread number starting from 1>
> > > in jmeter.log, both values should be 1-based
> > >
> > > Thanks and best regards,
> > > Ivan
> > >
> >
>
pmd
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

pmd
Thanks Ivan.
Would you like to provide a PR or patch ?:

- https://jmeter.apache.org/building.html

Thanks

On Fri, Sep 21, 2018 at 12:45 PM Ivan Rancati <[hidden email]>
wrote:

> hello,
>
> I entered a P3/minor bug with the documentation update request
> https://bz.apache.org/bugzilla/show_bug.cgi?id=62752
>
> Thanks and best regards
> Ivan
>
> On Thu, Sep 20, 2018 at 7:18 PM Deepak Shetty <[hidden email]> wrote:
>
> > I believe there is a discrepancy - The context reads it from the thread
> > which is 0 based and the other from the name.
> > Its probably late to change this without potentially breaking backward
> > compatibility - perhaps a documentation update is better .
> >
> > regards
> > deepak
> >
> > On Wed, Sep 19, 2018 at 12:54 AM Ivan Rancati <[hidden email]>
> > wrote:
> >
> > > As JMeter 5.0 has been released today, a quick update:
> > >
> > > the behaviour with the thread number is the same with JMeter 4.0 and
> > 5.0. I
> > > tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle
> > JDK
> > > 9 and Oracle JDK 10
> > >
> > > Thanks for the 5.0 release and best regards
> > >
> > > On Wed, Sep 19, 2018 at 8:00 AM Ivan Rancati <[hidden email]>
> > > wrote:
> > >
> > > > Good morning,
> > > >
> > > > I think that ctx.getThreadNum() returns a 0-based thread number,
> while
> > > the
> > > > variable __threadNum is 1-based.
> > > >
> > > > I have prepared test plan with a just a thread group, a constant
> > > > throughput timer and JSR223 sampler which just logs
> > > >
> > > > log.info("from ctx:"+ctx.getThreadNum())
> > > > log.info("from variable: ${__threadNum}")
> > > >
> > > > in jmeter.log I see for example for the first thread
> > > >
> > > > 2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started:
> > Thread
> > > > Group 1-1
> > > > ...
> > > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
> > > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from
> variable:
> > 1
> > > >
> > > > and so on. Am I reading incorrectly one of the two values?
> > > >
> > > > I thought, as the threads are numbered with <thread group starting
> from
> > > > 1>-<thread number starting from 1>
> > > > in jmeter.log, both values should be 1-based
> > > >
> > > > Thanks and best regards,
> > > > Ivan
> > > >
> > >
> >
>


--
Cordialement.
Philippe Mouawad.
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

Ivan Rancati-3
Hallo Philippe,

will do. It might take a few days, though.

Best,
Ivan

On Fri, Sep 21, 2018 at 12:47 PM Philippe Mouawad <
[hidden email]> wrote:

> Thanks Ivan.
> Would you like to provide a PR or patch ?:
>
> - https://jmeter.apache.org/building.html
>
> Thanks
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ctx.getThreadNum() and ${__threadNum}

Ivan Rancati-3
In reply to this post by pmd
hi,
sorry it took me a few days to try building. I downloaded with git clone
and have a couple of questions:

1) Option 2 : Setting up Eclipse project manually
In the instructions it looks like the same ant task has to be called twice.
Is it so? From the web page
---------
´╗┐he first step is to download dependencies by running the Ant command:

ant download_jars

Or you can download the binary distribution archive for a release and
unpack it into the same directory structure as the source. This will ensure
that the lib/ directory contains the jar files needed for running JMeter.
There are a few additional jars that are needed to build JMeter, download
these using:

ant download_jars

---------

2) What is the correct ant task to build the docs?
At the beginning of build.xml I see
-----
    To update documentation
      ant docs-site [-Ddocs.force=true]
      ant docs-printable [-Ddocs.force=true]
    To build API documentation (Javadoc)
      ant docs-api
    To build all the docs
      ant docs-all [-Ddocs.force=true]

-----
but docs-all is not a target (I checked with ant -projecthelp)

thanks and best regards,
Ivan

On Fri, Sep 21, 2018 at 12:47 PM Philippe Mouawad <
[hidden email]> wrote:

> Thanks Ivan.
> Would you like to provide a PR or patch ?:
>
> - https://jmeter.apache.org/building.html
>
> Thanks
>
> On Fri, Sep 21, 2018 at 12:45 PM Ivan Rancati <[hidden email]>
> wrote:
>
> > hello,
> >
> > I entered a P3/minor bug with the documentation update request
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=62752
> >
> > Thanks and best regards
> > Ivan
> >
> > On Thu, Sep 20, 2018 at 7:18 PM Deepak Shetty <[hidden email]> wrote:
> >
> > > I believe there is a discrepancy - The context reads it from the thread
> > > which is 0 based and the other from the name.
> > > Its probably late to change this without potentially breaking backward
> > > compatibility - perhaps a documentation update is better .
> > >
> > > regards
> > > deepak
> > >
> > > On Wed, Sep 19, 2018 at 12:54 AM Ivan Rancati <[hidden email]>
> > > wrote:
> > >
> > > > As JMeter 5.0 has been released today, a quick update:
> > > >
> > > > the behaviour with the thread number is the same with JMeter 4.0 and
> > > 5.0. I
> > > > tried both versions of JMeter on Linux with a mix of OpenJDK10,
> Oracle
> > > JDK
> > > > 9 and Oracle JDK 10
> > > >
> > > > Thanks for the 5.0 release and best regards
> > > >
> > > > On Wed, Sep 19, 2018 at 8:00 AM Ivan Rancati <[hidden email]
> >
> > > > wrote:
> > > >
> > > > > Good morning,
> > > > >
> > > > > I think that ctx.getThreadNum() returns a 0-based thread number,
> > while
> > > > the
> > > > > variable __threadNum is 1-based.
> > > > >
> > > > > I have prepared test plan with a just a thread group, a constant
> > > > > throughput timer and JSR223 sampler which just logs
> > > > >
> > > > > log.info("from ctx:"+ctx.getThreadNum())
> > > > > log.info("from variable: ${__threadNum}")
> > > > >
> > > > > in jmeter.log I see for example for the first thread
> > > > >
> > > > > 2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started:
> > > Thread
> > > > > Group 1-1
> > > > > ...
> > > > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
> > > > > 2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from
> > variable:
> > > 1
> > > > >
> > > > > and so on. Am I reading incorrectly one of the two values?
> > > > >
> > > > > I thought, as the threads are numbered with <thread group starting
> > from
> > > > > 1>-<thread number starting from 1>
> > > > > in jmeter.log, both values should be 1-based
> > > > >
> > > > > Thanks and best regards,
> > > > > Ivan
> > > > >
> > > >
> > >
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>