Ivan Rancati
2018-09-19 06:00:24 UTC
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
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