When using the settings "Generate parent sample" checked and "Include timer duration in generated sample" unchecked, samples generated by the transaction controller nevertheless include the duration of timers that are existing as children. When "Generate parent sample" is unchecked, the reported times correctly do not include the timers. With other words: "Include timer duration in generated sample" does not have any effect if "Generate parent sample" is checked.
Excludes timer option came with the Bug 41418, but the patch 41418 don't manage Excludes timer when Generate parent is on. (in code : Bug 41418 => TC.next2() but not TC.next1()) It's seems hard to solve.
Here's a suggestion to solve the problem. It requires changing the visibility of SampleResult's setEndTime from protected to public. Any concerns? original/src/core/org/apache/jmeter/control/TransactionSampler.java Thu Jul 08 22:42:36 2010 +++ new/src/core/org/apache/jmeter/control/TransactionSampler.java Wed Oct 27 16:19:32 2010 @@ -49,0 +50,2 @@ + private int totalTime = 0; + @@ -101,0 +104 @@ + totalTime += res.getTime(); @@ -113,0 +117,8 @@ + + if (!transactionController.isIncludeTimers()) { + long end = SampleResult.currentTimeInMs(); + + transactionSampleResult.setIdleTime(end - transactionSampleResult.getStartTime() - totalTime); + transactionSampleResult.setEndTime(end); + } +
(In reply to comment #2) Or without changing the visibility of setEndTime: src/core/org/apache/jmeter/control/TransactionSampler.java @@ -49,0 +50,2 @@ + private int totalTime = 0; + @@ -65 +67,2 @@ - transactionSampleResult.sampleStart(); + if (transactionController.isIncludeTimers()) + transactionSampleResult.sampleStart(); @@ -101 +104,9 @@ - transactionSampleResult.addSubResult(res); + if (transactionController.isIncludeTimers()) { + transactionSampleResult.addSubResult(res); + } else { + transactionSampleResult.setBytes(transactionSampleResult.getBytes() + res.getBytes()); + transactionSampleResult.addRawSubResult(res); + + totalTime += res.getTime(); + } + @@ -112,0 +124,7 @@ + } + + if (!transactionController.isIncludeTimers()) { + long end = SampleResult.currentTimeInMs(); + transactionSampleResult.setStampAndTime(end - totalTime, totalTime); + //transactionSampleResult.setIdleTime(end - transactionSampleResult.getStartTime() - totalTime); + //transactionSampleResult.setEndTime(end);
Thanks for your work and patch. The first approach seems better. The second approach comes with more changes in internal logic (addRawSubResult / setBytes vs addSubResult) I thinks changing visibility to public for setEndTime() isn't a problem. (next time: please used the file attachment field for your patch, Bugzilla cutting long lines) URL: http://svn.apache.org/viewvc?rev=1028437&view=rev Log: Bug 50080 - Transaction controller incorrectly creates samples including timer duration Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java jakarta/jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2411