Create test plan from HTTPS conversation.

2010-03-11 Thread Miklos Tverdota
Hi,

 

I worked a lot to with WebScarab to record HTTPS conversation to create
manually Jmeter test plans.

I wished to have a add-on to export the conversation directly to Jmeter test
plan.

Now I realized this project.

 

Advantage :

 

1) You can save a WebScarab conversation in files.

2) Reload the conversation in WebScarab any time and analyse it.

3) Create Jmeter test plan even from HTTPS conversation.

4) Verify your test plans through comparing WebScarab conversation to Jmeter
conversation.

 

I realized a new add-on to create Jmeter test plan from HTTP requests.

 

Concept:

1)  Read a template test plan into the Hash tree. (test plan, thread
group, http sampler, header)

2)  Create templates for http sampler and header

3)  Clone new Test Element from templates.

4)  Append new http requests to hash tree.

5)  Save hash tree to test plan.

 

I extracted several packages from the Jmeter source and modified them
slightly.

I minimized the number of libraries I needed. My add-on use depends only on
Xstream and Jorphan utilities.

Wrong decision: I ported all these packages to WebScarab source tree.

It would be better to create a new jar from these sources and drop only the
jar in WebScarab.

It is not difficult to create a new project for the jar.

This jar could been integrated in any other add-on. For example in FireFox.

 

Anyway the add-on in  works now pretty well.

 

If you interested, I can provide the sources.

 

Regards,

 

Miklos

 



svn commit: r921758 - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter: images/icon.properties threads/gui/AbstractThreadGroupGui.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 09:43:08 2010
New Revision: 921758

URL: http://svn.apache.org/viewvc?rev=921758view=rev
Log:
Bug 48883 - Corrections for AbstractThreadGroup

Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties

jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties?rev=921758r1=921757r2=921758view=diff
==
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties Thu 
Mar 11 09:43:08 2010
@@ -18,7 +18,7 @@
 # Value:   icon, optionally followed by space and then the disabled icon 
name
 org.apache.jmeter.control.gui.TestPlanGui=org/apache/jmeter/images/beaker.gif
 
org.apache.jmeter.timers.gui.AbstractTimerGui=org/apache/jmeter/images/timer.gif
-org.apache.jmeter.threads.gui.ThreadGroupGui=org/apache/jmeter/images/thread.gif
+org.apache.jmeter.threads.gui.AbstractThreadGroupGui=org/apache/jmeter/images/thread.gif
 
org.apache.jmeter.visualizers.gui.AbstractListenerGui=org/apache/jmeter/images/meter.png
 
org.apache.jmeter.config.gui.AbstractConfigGui=org/apache/jmeter/images/testtubes.png
 
org.apache.jmeter.processor.gui.AbstractPreProcessorGui=org/apache/jmeter/images/leafnode.gif

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java?rev=921758r1=921757r2=921758view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java
 Thu Mar 11 09:43:08 2010
@@ -20,7 +20,6 @@ package org.apache.jmeter.threads.gui;
 
 import java.awt.BorderLayout;
 import java.awt.Dimension;
-import java.awt.event.ItemListener;
 import java.util.Arrays;
 import java.util.Collection;
 import javax.swing.BorderFactory;
@@ -39,7 +38,7 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.threads.AbstractThreadGroup;
 import org.apache.jmeter.util.JMeterUtils;
 
-public abstract class AbstractThreadGroupGui extends 
AbstractJMeterGuiComponent implements ItemListener {
+public abstract class AbstractThreadGroupGui extends 
AbstractJMeterGuiComponent {
 private static final long serialVersionUID = 240L;
 
 // Sampler error action buttons



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



DO NOT REPLY [Bug 48883] Corrections for AbstractThreadGroup

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48883

Sebb s...@apache.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #1 from Sebb s...@apache.org 2010-03-11 09:48:42 UTC ---
Thanks, fixed:

URL: http://svn.apache.org/viewvc?rev=921758view=rev
Log:
Bug 48883 - Corrections for AbstractThreadGroup

Modified:
   jakarta/jmeter/trunk/src/core/org/apache/jmeter/images/icon.properties
  
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/gui/AbstractThreadGroupGui.java

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



DO NOT REPLY [Bug 48889] New: Wrong response time with mode=Statistical and num_sample_threshold 1

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48889

   Summary: Wrong response time with mode=Statistical and
num_sample_threshold  1
   Product: JMeter
   Version: 2.3.4
  Platform: PC
OS/Version: All
Status: NEW
  Severity: major
  Priority: P2
 Component: Main
AssignedTo: jmeter-dev@jakarta.apache.org
ReportedBy: j.kalsb...@jk-itberatung.de


I’ve got a master-slave setup and need to do statistical sampling because
otherwise the master dies on OutOfMemory. I use an Aggregate Graph/Report as
recommended. The calculated values for hits/sec reported by the listeners are
wrong.

To analyze the situation use I the following testplan:

-Threadgroup with 10 threads running for 100 iterations
-BeanShell Sampler sleeping for 500 millis
-AggregateGraph/Report


Now the results must be more or like:
-Hits/sec just below 20 (like 19.6)
-Average response time approx 500 millis

Local execution delivers this result.

Set num_sample_threshold=1 and time_threshold=3600 delivers this result.

Set num_sample_threshold=100 time_threshold=3600 delivers
-Hits/sec 19.7
-Average response time 56!

The response time varies with the sample_threshold but always is way to low.
The higher the sample_threshold the higher the delta between real and reported
response time

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



DO NOT REPLY [Bug 48878] OutOfMemory unzipping certain type of response

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48878

Sebb s...@apache.org changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #3 from Sebb s...@apache.org 2010-03-11 09:55:30 UTC ---
I don't think there's anything the JMeter code can do to protect against such
occurrences.

Seems to me that this bug should be raised against Java, not JMeter.

However, if you can provide a simple test case that triggers the problem, that
would be helpful.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



Re: Create test plan from HTTPS conversation.

2010-03-11 Thread raghavendra kumar
hi Miklos,

Can u provide the source for this


thanks in advance,

raghavendra

On Thu, Mar 11, 2010 at 3:12 PM, Miklos Tverdota tverd...@gmx.de wrote:

 Hi,



 I worked a lot to with WebScarab to record HTTPS conversation to create
 manually Jmeter test plans.

 I wished to have a add-on to export the conversation directly to Jmeter
 test
 plan.

 Now I realized this project.



 Advantage :



 1) You can save a WebScarab conversation in files.

 2) Reload the conversation in WebScarab any time and analyse it.

 3) Create Jmeter test plan even from HTTPS conversation.

 4) Verify your test plans through comparing WebScarab conversation to
 Jmeter
 conversation.



 I realized a new add-on to create Jmeter test plan from HTTP requests.



 Concept:

 1)  Read a template test plan into the Hash tree. (test plan, thread
 group, http sampler, header)

 2)  Create templates for http sampler and header

 3)  Clone new Test Element from templates.

 4)  Append new http requests to hash tree.

 5)  Save hash tree to test plan.



 I extracted several packages from the Jmeter source and modified them
 slightly.

 I minimized the number of libraries I needed. My add-on use depends only on
 Xstream and Jorphan utilities.

 Wrong decision: I ported all these packages to WebScarab source tree.

 It would be better to create a new jar from these sources and drop only the
 jar in WebScarab.

 It is not difficult to create a new project for the jar.

 This jar could been integrated in any other add-on. For example in FireFox.



 Anyway the add-on in  works now pretty well.



 If you interested, I can provide the sources.



 Regards,



 Miklos






svn commit: r921796 - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers: BatchSampleSender.java StatisticalSampleSender.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 10:52:18 2010
New Revision: 921796

URL: http://svn.apache.org/viewvc?rev=921796view=rev
Log:
Might as well be static variables

Modified:

jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java

jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java?rev=921796r1=921795r2=921796view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java 
(original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java 
Thu Mar 11 10:52:18 2010
@@ -47,7 +47,7 @@ public class BatchSampleSender implement
 private final int numSamplesThreshold = 
 JMeterUtils.getPropDefault(num_sample_threshold, 
DEFAULT_NUM_SAMPLE_THRESHOLD); // $NON-NLS-1$
 
-private final long timeThreshold =
+private static final long TIME_THRESHOLD_MS =
 JMeterUtils.getPropDefault(time_threshold, DEFAULT_TIME_THRESHOLD); 
// $NON-NLS-1$
 
 private long batchSendTime = -1;
@@ -70,7 +70,7 @@ public class BatchSampleSender implement
 this.listener = listener;
 log.info(Using batching for this run.
 +  Thresholds: num= + numSamplesThreshold
-+ , time= + timeThreshold);
++ , time= + TIME_THRESHOLD_MS);
 }
 
 /**
@@ -134,13 +134,13 @@ public class BatchSampleSender implement
 }
 }
 
-if (timeThreshold != -1) {
+if (TIME_THRESHOLD_MS != -1) {
 SampleResult sr = e.getResult();
 long timestamp = sr.getTimeStamp();
 
 // Checking for and creating initial timestamp to cheak against
 if (batchSendTime == -1) {
-this.batchSendTime = timestamp + timeThreshold;
+this.batchSendTime = timestamp + TIME_THRESHOLD_MS;
 }
 
 if (batchSendTime  timestamp) {
@@ -150,7 +150,7 @@ public class BatchSampleSender implement
 listener.processBatch(sampleStore);
 sampleStore.clear();
 }
-this.batchSendTime = timestamp + timeThreshold;
+this.batchSendTime = timestamp + TIME_THRESHOLD_MS;
 } catch (RemoteException err) {
 log.error(sampleOccurred, err);
 }

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java?rev=921796r1=921795r2=921796view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
 Thu Mar 11 10:52:18 2010
@@ -53,7 +53,7 @@ public class StatisticalSampleSender imp
 
 private int sampleCount;
 
-private final long timeThreshold = 
JMeterUtils.getPropDefault(time_threshold,
+private static final long TIME_THRESHOLD_MS = 
JMeterUtils.getPropDefault(time_threshold,
 DEFAULT_TIME_THRESHOLD);
 
 private long batchSendTime = -1;
@@ -76,7 +76,7 @@ public class StatisticalSampleSender imp
 StatisticalSampleSender(RemoteSampleListener listener) {
 this.listener = listener;
 log.info(Using batching for this run. +  Thresholds: num=
-+ numSamplesThreshold + , time= + timeThreshold);
++ numSamplesThreshold + , time= + TIME_THRESHOLD_MS);
 }
 
 /**
@@ -148,11 +148,11 @@ public class StatisticalSampleSender imp
 }
 }
 
-if (timeThreshold != -1) {
+if (TIME_THRESHOLD_MS != -1) {
 long now = System.currentTimeMillis();
 // Checking for and creating initial timestamp to cheak against
 if (batchSendTime == -1) {
-this.batchSendTime = now + timeThreshold;
+this.batchSendTime = now + TIME_THRESHOLD_MS;
 }
 
 if (batchSendTime  now) {
@@ -161,7 +161,7 @@ public class StatisticalSampleSender imp
 log.debug(Firing time);
 }
 sendBatch();
-this.batchSendTime = now + timeThreshold;
+this.batchSendTime = now + TIME_THRESHOLD_MS;
 } catch (RemoteException err) {
 log.warn(sampleOccurred, 

svn commit: r921807 - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers: BatchSampleSender.java StatisticalSampleSender.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 11:37:54 2010
New Revision: 921807

URL: http://svn.apache.org/viewvc?rev=921807view=rev
Log:
Simplify. Ensure only count or timer fire for a given sample.

Modified:

jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java

jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java?rev=921807r1=921806r2=921807view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java 
(original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java 
Thu Mar 11 11:37:54 2010
@@ -40,16 +40,16 @@ public class BatchSampleSender implement
 
 private static final long DEFAULT_TIME_THRESHOLD = 6L;
 
-private final RemoteSampleListener listener;
-
-private final ListSampleEvent sampleStore = new ArrayListSampleEvent();
-
-private final int numSamplesThreshold = 
+private static final int NUM_SAMPLES_THRESHOLD = 
 JMeterUtils.getPropDefault(num_sample_threshold, 
DEFAULT_NUM_SAMPLE_THRESHOLD); // $NON-NLS-1$
 
 private static final long TIME_THRESHOLD_MS =
 JMeterUtils.getPropDefault(time_threshold, DEFAULT_TIME_THRESHOLD); 
// $NON-NLS-1$
 
+private final RemoteSampleListener listener;
+
+private final ListSampleEvent sampleStore = new ArrayListSampleEvent();
+
 private long batchSendTime = -1;
 
 /**
@@ -69,7 +69,7 @@ public class BatchSampleSender implement
 BatchSampleSender(RemoteSampleListener listener) {
 this.listener = listener;
 log.info(Using batching for this run.
-+  Thresholds: num= + numSamplesThreshold
++  Thresholds: num= + NUM_SAMPLES_THRESHOLD
 + , time= + TIME_THRESHOLD_MS);
 }
 
@@ -121,41 +121,39 @@ public class BatchSampleSender implement
 public void sampleOccurred(SampleEvent e) {
 synchronized (sampleStore) {
 sampleStore.add(e);
+final int sampleCount = sampleStore.size();
 
-if (numSamplesThreshold != -1) {
-if (sampleStore.size() = numSamplesThreshold) {
-try {
-log.debug(Firing sample);
-listener.processBatch(sampleStore);
-sampleStore.clear();
-} catch (RemoteException err) {
-log.error(sampleOccurred, err);
-}
+boolean sendNow = false;
+if (NUM_SAMPLES_THRESHOLD != -1) {
+if (sampleCount = NUM_SAMPLES_THRESHOLD) {
+sendNow = true;
 }
 }
 
+long now = 0;
 if (TIME_THRESHOLD_MS != -1) {
-SampleResult sr = e.getResult();
-long timestamp = sr.getTimeStamp();
-
-// Checking for and creating initial timestamp to cheak against
+now = System.currentTimeMillis();
+// Checking for and creating initial timestamp to check against
 if (batchSendTime == -1) {
-this.batchSendTime = timestamp + TIME_THRESHOLD_MS;
+this.batchSendTime = now + TIME_THRESHOLD_MS;
+}
+if (batchSendTime  now  sampleCount  0) {
+sendNow = true;
 }
+}
 
-if (batchSendTime  timestamp) {
-try {
-log.debug(Firing time);
-if (sampleStore.size()  0) {
-listener.processBatch(sampleStore);
-sampleStore.clear();
-}
-this.batchSendTime = timestamp + TIME_THRESHOLD_MS;
-} catch (RemoteException err) {
-log.error(sampleOccurred, err);
+if (sendNow){
+try {
+log.debug(Firing sample);
+listener.processBatch(sampleStore);
+sampleStore.clear();
+if (TIME_THRESHOLD_MS != -1) {
+this.batchSendTime = now + TIME_THRESHOLD_MS;
 }
-}
+} catch (RemoteException err) {
+log.error(sampleOccurred, err);
+}
 }
-}
+} // synchronized(sampleStore)
 }
 }

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
URL: 

DO NOT REPLY [Bug 48889] Wrong response time with mode=Statistical and num_sample_threshold 1

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48889

--- Comment #1 from JottKa j.kalsb...@jk-itberatung.de 2010-03-11 12:57:40 
UTC ---
Created an attachment (id=25115)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25115)
proposed patch

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



DO NOT REPLY [Bug 48889] Wrong response time with mode=Statistical and num_sample_threshold 1

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48889

--- Comment #3 from JottKa j.kalsb...@jk-itberatung.de 2010-03-11 15:55:35 
UTC ---
(In reply to comment #2)
 Thanks for the suggested patch, which should help.
 
 However, I think the threadGroup is still needed, otherwise unrelated threads
 in different thread groups will be aggregated, leading to the same problem.

Yes but at least with the current implementation the
event.getResult().getThreadName() call already contains the threadGroup name. A
typical key would be NameOfSampler-NameOfThreadGroup 1-10. I just verified
the proper working with two threadgroups. But an explicit call to
getThreadGroup would make it more robust.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922051 - in /jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math: StatCalculator.java StatCalculatorInteger.java StatCalculatorLong.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 22:55:21 2010
New Revision: 922051

URL: http://svn.apache.org/viewvc?rev=922051view=rev
Log:
Implement addValue(T val, int sampleCount) method to simplify processing 
aggregated samples

Modified:
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java

jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorInteger.java

jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorLong.java

Modified: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java?rev=922051r1=922050r2=922051view=diff
==
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java 
(original)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java 
Thu Mar 11 22:55:21 2010
@@ -191,29 +191,44 @@ public abstract class StatCalculatorT e
 return count;
 }
 
-public void addValue(T val) {
-updateValueCount(val);
-count++;
+protected abstract T divide(T val, int n);
+
+public void addValue(T val, int sampleCount) {
+updateValueCount(val, sampleCount);
+count += sampleCount;
 double currentVal = val.doubleValue();
 sum += currentVal;
-sumOfSquares += currentVal * currentVal;
+T actualValue = val;
+if (sampleCount  1){
+// For n values in an aggregate sample the average value = (val/n)
+// So need to add n * (val/n) * (val/n) = val * val / n
+sumOfSquares += currentVal * currentVal / sampleCount;
+actualValue = divide(val, sampleCount);
+} else {
+sumOfSquares += currentVal * currentVal;
+actualValue = val;
+}
 mean = sum / count;
 deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));
-if (val.compareTo(max)  0){
-max=val;
+if (actualValue.compareTo(max)  0){
+max=actualValue;
 }
-if (val.compareTo(min)  0){
-min=val;
+if (actualValue.compareTo(min)  0){
+min=actualValue;
 }
 }
 
-private void updateValueCount(T val) {
+public void addValue(T val) {
+addValue(val,1);
+}
+
+private void updateValueCount(T val, int sampleCount) {
 MutableLong count = valuesMap.get(val);
 if (count != null) {
-count.increment();
+count.add(sampleCount);
 } else {
 // insert new value
-valuesMap.put(val, new MutableLong(1L));
+valuesMap.put(val, new MutableLong(sampleCount));
 }
 }
 }

Modified: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorInteger.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorInteger.java?rev=922051r1=922050r2=922051view=diff
==
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorInteger.java
 (original)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorInteger.java
 Thu Mar 11 22:55:21 2010
@@ -30,4 +30,13 @@ public class StatCalculatorInteger exten
 public void addValue(int val){
 super.addValue(new Integer(val));
 }
+
+public void addValue(int val, int sampleCount){
+super.addValue(new Integer(val), sampleCount);
+}
+
+@Override
+protected Integer divide(Integer val, int n) {
+return new Integer(val.intValue() / n);
+}
 }

Modified: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorLong.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorLong.java?rev=922051r1=922050r2=922051view=diff
==
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorLong.java
 (original)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculatorLong.java
 Thu Mar 11 22:55:21 2010
@@ -30,4 +30,13 @@ public class StatCalculatorLong extends 
 public void addValue(long val){
 super.addValue(new Long(val));
 }
+
+public void addValue(long val, int sampleCount){
+super.addValue(new Long(val), sampleCount);
+}
+
+@Override
+protected Long divide(Long val, int n) {
+return new Long(val.longValue() / n);
+}
 }



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922054 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 22:57:58 2010
New Revision: 922054

URL: http://svn.apache.org/viewvc?rev=922054view=rev
Log:
Correct calculation of min, max and std. deviation for aggregated samples

Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java?rev=922054r1=922053r2=922054view=diff
==
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java Thu 
Mar 11 22:57:58 2010
@@ -73,11 +73,19 @@ public class Calculator {
 
 private void addValue(long newValue, int sampleCount) {
 count += sampleCount;
-minimum=Math.min(newValue, minimum);
-maximum=Math.max(newValue, maximum);
 double currentVal = newValue;
 sum += currentVal;
-sumOfSquares += currentVal * currentVal;
+if (sampleCount  1){
+minimum=Math.min(newValue/sampleCount, minimum);
+maximum=Math.max(newValue/sampleCount, maximum);
+// For n values in an aggregate sample the average value = (val/n)
+// So need to add n * (val/n) * (val/n) = val * val / n
+sumOfSquares += (currentVal * currentVal) / (sampleCount);
+} else {
+minimum=Math.min(newValue, minimum);
+maximum=Math.max(newValue, maximum);
+sumOfSquares += currentVal * currentVal;
+}
 // Calculate each time, as likely to be called for each add
 mean = sum / count;
 deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922055 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 23:00:43 2010
New Revision: 922055

URL: http://svn.apache.org/viewvc?rev=922055view=rev
Log:
Simplify (and tweak accuracy) by using new addValue(T val, int count) method

Modified:

jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java?rev=922055r1=922054r2=922055view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
 Thu Mar 11 23:00:43 2010
@@ -150,20 +150,8 @@ public class SamplingStatCalculator {
 double throughput;
 boolean rbool;
 synchronized (calculator) {
-long byteslength = res.getBytes();
-// if there was more than 1 loop in the sample, we
-// handle it appropriately
-if (res.getSampleCount()  1) {
-long time = res.getTime() / res.getSampleCount();
-long resbytes = byteslength / res.getSampleCount();
-for (int idx = 0; idx  res.getSampleCount(); idx++) {
-calculator.addValue(time);
-calculator.addBytes(resbytes);
-}
-} else {
-calculator.addValue(res.getTime());
-calculator.addBytes(byteslength);
-}
+calculator.addValue(res.getTime(), res.getSampleCount());
+calculator.addBytes(res.getBytes());
 setStartTime(res);
 eCount = getCurrentSample().getErrorCount();
 if (!res.isSuccessful()) {



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922067 - /jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 23:30:34 2010
New Revision: 922067

URL: http://svn.apache.org/viewvc?rev=922067view=rev
Log:
Fix up values map for aggregate samples

Modified:
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java

Modified: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java?rev=922067r1=922066r2=922067view=diff
==
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java 
(original)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java 
Thu Mar 11 23:30:34 2010
@@ -194,7 +194,6 @@ public abstract class StatCalculatorT e
 protected abstract T divide(T val, int n);
 
 public void addValue(T val, int sampleCount) {
-updateValueCount(val, sampleCount);
 count += sampleCount;
 double currentVal = val.doubleValue();
 sum += currentVal;
@@ -208,6 +207,7 @@ public abstract class StatCalculatorT e
 sumOfSquares += currentVal * currentVal;
 actualValue = val;
 }
+updateValueCount(actualValue, sampleCount);
 mean = sum / count;
 deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));
 if (actualValue.compareTo(max)  0){
@@ -222,13 +222,13 @@ public abstract class StatCalculatorT e
 addValue(val,1);
 }
 
-private void updateValueCount(T val, int sampleCount) {
-MutableLong count = valuesMap.get(val);
+private void updateValueCount(T actualValue, int sampleCount) {
+MutableLong count = valuesMap.get(actualValue);
 if (count != null) {
 count.add(sampleCount);
 } else {
 // insert new value
-valuesMap.put(val, new MutableLong(sampleCount));
+valuesMap.put(actualValue, new MutableLong(sampleCount));
 }
 }
 }



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922069 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 23:33:24 2010
New Revision: 922069

URL: http://svn.apache.org/viewvc?rev=922069view=rev
Log:
Bug 48889 - Wrong response time with mode=Statistical and num_sample_threshold 
 1
Maintain elapsed time locally; change to threadName key to allow its use in 
aggregate sample

Modified:

jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java?rev=922069r1=922068r2=922069view=diff
==
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleResult.java
 Thu Mar 11 23:33:24 2010
@@ -28,10 +28,13 @@ import java.io.Serializable;
 public class StatisticalSampleResult extends SampleResult implements
 Serializable {
 
-private static final long serialVersionUID = 24L;
+private static final long serialVersionUID = 240L;
 
 private int errorCount;
 
+// Need to maintain our own elapsed timer to ensure more accurate 
aggregation
+private long elapsed;
+
 public StatisticalSampleResult(){// May be called by XStream
 }
 
@@ -51,10 +54,11 @@ public class StatisticalSampleResult ext
 public StatisticalSampleResult(SampleResult res) {
 // Copy data that is shared between samples (i.e. the key items):
 setSampleLabel(res.getSampleLabel());
-// Nothing else can be saved, as the samples may come from any thread
+setThreadName(res.getThreadName());
 
 setSuccessful(true); // Assume result is OK
 setSampleCount(0); // because we add the sample count in later
+elapsed = 0;
 }
 
 public void add(SampleResult res) {
@@ -79,11 +83,12 @@ public class StatisticalSampleResult ext
 
 setLatency(getLatency()+ res.getLatency());
 
+elapsed += res.getTime();
 }
 
 @Override
 public long getTime() {
-return getEndTime() - getStartTime() - this.getIdleTime();
+return elapsed;
 }
 
 @Override
@@ -103,7 +108,7 @@ public class StatisticalSampleResult ext
 
 /**
  * Generates the key to be used for aggregating samples as follows:br/
- * codesampleLabel/code - codethreadGroup/code
+ * codesampleLabel/code - codethreadName/code
  *
  * N.B. the key should agree with the fixed items that are saved in the 
sample.
  *
@@ -112,7 +117,8 @@ public class StatisticalSampleResult ext
  */
 public static String getKey(SampleEvent event) {
 StringBuilder sb = new StringBuilder(80);
-
sb.append(event.getResult().getSampleLabel()).append(-).append(event.getThreadGroup());
+sb.append(event.getResult().getSampleLabel());
+sb.append('-').append(event.getResult().getThreadName());
 return sb.toString();
 }
 }



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922072 - /jakarta/jmeter/trunk/xdocs/changes.xml

2010-03-11 Thread sebb
Author: sebb
Date: Thu Mar 11 23:35:58 2010
New Revision: 922072

URL: http://svn.apache.org/viewvc?rev=922072view=rev
Log:
Bug 48889 - Wrong response time with mode=Statistical and num_sample_threshold 
 1
See also SVN revisions: 922069,922067,922055,922054,922051

Modified:
jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=922072r1=922071r2=922072view=diff
==
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Mar 11 23:35:58 2010
@@ -111,6 +111,8 @@ The XPath Assertion and XPath Extractor 
 h3Listeners/h3
 ul
 liBug 48603 - Mailer Visualiser sends two emails for a single failed 
response/li
+liCorrect calculation of min/max/std.dev for aggregated samples (Summary 
Report)/li
+liBug 48889 - Wrong response time with mode=Statistical and 
num_sample_threshold  1/li
 /ul
 
 h3Assertions/h3



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



DO NOT REPLY [Bug 48889] Wrong response time with mode=Statistical and num_sample_threshold 1

2010-03-11 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48889

Sebb s...@apache.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #4 from Sebb s...@apache.org 2010-03-11 23:40:11 UTC ---
Turns out that the problem was not really due to aggregating across thread
groups.

The StatisticalSampleResult now maintains the elapsed time directly, rather
than trying to fake it by setting the start and end times.

See:

URL: http://svn.apache.org/viewvc?rev=922072view=rev
Log:
Bug 48889 - Wrong response time with mode=Statistical and num_sample_threshold
 1
See also SVN revisions: 922069,922067,922055,922054,922051

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org



svn commit: r922086 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java

2010-03-11 Thread sebb
Author: sebb
Date: Fri Mar 12 00:35:36 2010
New Revision: 922086

URL: http://svn.apache.org/viewvc?rev=922086view=rev
Log:
Give clue if AIOBE occurs

Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java?rev=922086r1=922085r2=922086view=diff
==
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java 
Fri Mar 12 00:35:36 2010
@@ -25,6 +25,7 @@ import java.net.UnknownHostException;
 import org.apache.jmeter.threads.JMeterVariables;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.util.JMeterError;
 import org.apache.log.Logger;
 
 /**
@@ -142,7 +143,11 @@ public class SampleEvent implements Seri
 
 /** Get the nth variable value (zero-based) */
 public String getVarValue(int i){
-return values[i];
+try {
+return values[i];
+} catch (ArrayIndexOutOfBoundsException e) {
+throw new JMeterError(Check the sample_variable settings!, e);
+}
 }
 
 public SampleResult getResult() {



-
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org