Bug 50080 - Transaction controller incorrectly creates samples including timer duration
Transaction controller incorrectly creates samples including timer duration
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.4
PC Windows XP
: P2 normal with 1 vote (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-10-12 08:18 UTC by jens_0
Modified: 2010-10-28 15:14 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jens_0 2010-10-12 08:18:43 UTC
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.
Comment 1 Milamber 2010-10-14 03:38:40 UTC
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.
Comment 2 jens_0 2010-10-27 10:33:14 UTC
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);
+        }
+
Comment 3 jens_0 2010-10-28 04:50:25 UTC
(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);
Comment 4 Milamber 2010-10-28 15:14:39 UTC
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