Discussion:
ctx.getThreadNum() and ${__threadNum}
Ivan Rancati
2018-09-19 06:00:24 UTC
Permalink
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
Ivan Rancati
2018-09-19 07:53:48 UTC
Permalink
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
Post by Ivan Rancati
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
Deepak Shetty
2018-09-20 17:04:13 UTC
Permalink
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
Post by Ivan Rancati
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
Post by Ivan Rancati
Good morning,
I think that ctx.getThreadNum() returns a 0-based thread number, while
the
Post by Ivan Rancati
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
Ivan Rancati
2018-09-21 10:45:14 UTC
Permalink
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
Post by Deepak Shetty
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
Post by Ivan Rancati
the behaviour with the thread number is the same with JMeter 4.0 and
5.0. I
Post by Ivan Rancati
tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle
JDK
Post by Ivan Rancati
9 and Oracle JDK 10
Thanks for the 5.0 release and best regards
Post by Ivan Rancati
Good morning,
I think that ctx.getThreadNum() returns a 0-based thread number, while
the
Post by Ivan Rancati
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
Thread
Post by Ivan Rancati
Post by Ivan Rancati
Group 1-1
...
2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
1
Post by Ivan Rancati
Post by Ivan Rancati
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
Philippe Mouawad
2018-09-21 10:47:23 UTC
Permalink
Thanks Ivan.
Would you like to provide a PR or patch ?:

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

Thanks
Post by Ivan Rancati
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
Post by Deepak Shetty
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
Post by Ivan Rancati
the behaviour with the thread number is the same with JMeter 4.0 and
5.0. I
Post by Ivan Rancati
tried both versions of JMeter on Linux with a mix of OpenJDK10, Oracle
JDK
Post by Ivan Rancati
9 and Oracle JDK 10
Thanks for the 5.0 release and best regards
Post by Ivan Rancati
Good morning,
I think that ctx.getThreadNum() returns a 0-based thread number,
while
Post by Deepak Shetty
Post by Ivan Rancati
the
Post by Ivan Rancati
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
Thread
Post by Ivan Rancati
Post by Ivan Rancati
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
1
Post by Ivan Rancati
Post by Ivan Rancati
and so on. Am I reading incorrectly one of the two values?
I thought, as the threads are numbered with <thread group starting
from
Post by Deepak Shetty
Post by Ivan Rancati
Post by Ivan Rancati
1>-<thread number starting from 1>
in jmeter.log, both values should be 1-based
Thanks and best regards,
Ivan
--
Cordialement.
Philippe Mouawad.
Ivan Rancati
2018-09-21 15:41:04 UTC
Permalink
Hallo Philippe,

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

Best,
Ivan

On Fri, Sep 21, 2018 at 12:47 PM Philippe Mouawad <
Post by Philippe Mouawad
Thanks Ivan.
- https://jmeter.apache.org/building.html
Thanks
Ivan Rancati
2018-09-28 13:23:40 UTC
Permalink
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 <
Post by Philippe Mouawad
Thanks Ivan.
- https://jmeter.apache.org/building.html
Thanks
Post by Ivan Rancati
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
Post by Deepak Shetty
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
Post by Ivan Rancati
the behaviour with the thread number is the same with JMeter 4.0 and
5.0. I
Post by Ivan Rancati
tried both versions of JMeter on Linux with a mix of OpenJDK10,
Oracle
Post by Ivan Rancati
Post by Deepak Shetty
JDK
Post by Ivan Rancati
9 and Oracle JDK 10
Thanks for the 5.0 release and best regards
Post by Ivan Rancati
Good morning,
I think that ctx.getThreadNum() returns a 0-based thread number,
while
Post by Deepak Shetty
Post by Ivan Rancati
the
Post by Ivan Rancati
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
Thread
Post by Ivan Rancati
Post by Ivan Rancati
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
1
Post by Ivan Rancati
Post by Ivan Rancati
and so on. Am I reading incorrectly one of the two values?
I thought, as the threads are numbered with <thread group starting
from
Post by Deepak Shetty
Post by Ivan Rancati
Post by Ivan Rancati
1>-<thread number starting from 1>
in jmeter.log, both values should be 1-based
Thanks and best regards,
Ivan
--
Cordialement.
Philippe Mouawad.
Loading...