Author: pmouawad Date: Sat Oct 15 13:34:54 2016 New Revision: 1765062 URL: http://svn.apache.org/viewvc?rev=1765062&view=rev Log: Bug 60252 - Add sent kbytes/s to Aggregate Report and Summary report Bugzilla Id: 60252
Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/component_reference.xml Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original) +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Sat Oct 15 13:34:54 2016 @@ -119,20 +119,23 @@ public class StatGraphVisualizer extends "aggregate_report_max", //$NON-NLS-1$ "aggregate_report_error%", //$NON-NLS-1$ "aggregate_report_rate", //$NON-NLS-1$ - "aggregate_report_bandwidth" }; //$NON-NLS-1$ + "aggregate_report_bandwidth", //$NON-NLS-1$ + "aggregate_report_sent_bytes_per_sec" //$NON-NLS-1$ + }; - static final Object[][] COLUMNS_MSG_PARAMETERS = { null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - new Object[]{pct1Label}, //$NON-NLS-1$ - new Object[]{pct2Label}, //$NON-NLS-1$ - new Object[]{pct3Label}, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null, //$NON-NLS-1$ - null }; //$NON-NLS-1$ + static final Object[][] COLUMNS_MSG_PARAMETERS = { null, + null, + null, + null, + new Object[]{pct1Label}, + new Object[]{pct2Label}, + new Object[]{pct3Label}, + null, + null, + null, + null, + null, + null}; private final String[] GRAPH_COLUMNS = {"average",//$NON-NLS-1$ "aggregate_report_median", //$NON-NLS-1$ @@ -305,11 +308,12 @@ public class StatGraphVisualizer extends new Functor("getMax"), //$NON-NLS-1$ new Functor("getErrorPercentage"), //$NON-NLS-1$ new Functor("getRate"), //$NON-NLS-1$ - new Functor("getKBPerSecond") }, //$NON-NLS-1$ - new Functor[] { null, null, null, null, null, null, null, null, null, null, null, null }, + new Functor("getKBPerSecond"), //$NON-NLS-1$ + new Functor("getSentKBPerSecond") }, //$NON-NLS-1$ + new Functor[] { null, null, null, null, null, null, null, null, null, null, null, null, null }, new Class[] { String.class, Long.class, Long.class, Long.class, Long.class, Long.class, Long.class, Long.class, Long.class, String.class, - String.class, String.class }); + String.class, String.class, String.class}); } // Column formats @@ -326,7 +330,8 @@ public class StatGraphVisualizer extends null, // Max new DecimalFormat("#0.00%"), // Error %age //$NON-NLS-1$ new DecimalFormat("#.0"), // Throughput //$NON-NLS-1$ - new DecimalFormat("#.0") // pageSize //$NON-NLS-1$ + new DecimalFormat("#0.00"), // Throughput //$NON-NLS-1$ + new DecimalFormat("#0.00") // pageSize //$NON-NLS-1$ }; // Column renderers @@ -343,7 +348,8 @@ public class StatGraphVisualizer extends null, // Max new NumberRenderer("#0.00%"), // Error %age //$NON-NLS-1$ new RateRenderer("#.0"), // Throughput //$NON-NLS-1$ - new NumberRenderer("#.0"), // pageSize //$NON-NLS-1$ + new NumberRenderer("#0.00"), // Received bytes per sec //$NON-NLS-1$ + new NumberRenderer("#0.00"), // Sent bytes per sec //$NON-NLS-1$ }; public static boolean testFunctors(){ Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java (original) +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java Sat Oct 15 13:34:54 2016 @@ -78,6 +78,7 @@ public class SummaryReport extends Abstr "aggregate_report_error%", //$NON-NLS-1$ "aggregate_report_rate", //$NON-NLS-1$ "aggregate_report_bandwidth", //$NON-NLS-1$ + "aggregate_report_sent_bytes_per_sec", //$NON-NLS-1$ "average_bytes", //$NON-NLS-1$ }; @@ -118,6 +119,7 @@ public class SummaryReport extends Abstr new NumberRenderer("#0.00%"), // Error %age //$NON-NLS-1$ new RateRenderer("#.0"), // Throughput //$NON-NLS-1$ new NumberRenderer("#0.00"), // kB/sec //$NON-NLS-1$ + new NumberRenderer("#0.00"), // sent kB/sec //$NON-NLS-1$ new NumberRenderer("#.0"), // avg. pageSize //$NON-NLS-1$ }; @@ -133,6 +135,7 @@ public class SummaryReport extends Abstr new DecimalFormat("#0.00%"), // Error %age //$NON-NLS-1$ new DecimalFormat("#.0"), // Throughput //$NON-NLS-1$ new DecimalFormat("#0.00"), // kB/sec //$NON-NLS-1$ + new DecimalFormat("#0.00"), // sent kB/sec //$NON-NLS-1$ new DecimalFormat("#.0"), // avg. pageSize //$NON-NLS-1$ }; @@ -150,11 +153,12 @@ public class SummaryReport extends Abstr new Functor("getErrorPercentage"), //$NON-NLS-1$ new Functor("getRate"), //$NON-NLS-1$ new Functor("getKBPerSecond"), //$NON-NLS-1$ + new Functor("getSentKBPerSecond"), //$NON-NLS-1$ new Functor("getAvgPageBytes"), //$NON-NLS-1$ }, - new Functor[] { null, null, null, null, null, null, null, null , null, null }, + new Functor[] { null, null, null, null, null, null, null, null , null, null, null }, new Class[] { String.class, Long.class, Long.class, Long.class, Long.class, - String.class, String.class, String.class, String.class, String.class }); + String.class, String.class, String.class, String.class, String.class, String.class }); clearData(); init(); } Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original) +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sat Oct 15 13:34:54 2016 @@ -81,7 +81,8 @@ aggregate_report_xx_pct1_line={0}% Line aggregate_report_xx_pct2_line={0}% Line aggregate_report_xx_pct3_line={0}% Line aggregate_report_90=90% -aggregate_report_bandwidth=KB/sec +aggregate_report_bandwidth=Received KB/sec +aggregate_report_sent_bytes_per_sec=Sent KB/sec aggregate_report_count=# Samples aggregate_report_error=Error aggregate_report_error%=Error % Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original) +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sat Oct 15 13:34:54 2016 @@ -71,7 +71,8 @@ aggregate_graph_xaxis_group=Abscisses aggregate_graph_yaxis_group=Ordonn\u00E9es (milli-secondes) aggregate_graph_yaxis_max_value=Echelle maximum \: aggregate_report=Rapport agr\u00E9g\u00E9 -aggregate_report_bandwidth=Ko/sec +aggregate_report_bandwidth=Ko/sec re\u00e7us +aggregate_report_sent_bytes_per_sec=KB/sec \u00E9mis aggregate_report_count=\# Echantillons aggregate_report_error=Erreur aggregate_report_error%=% Erreur Modified: jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/util/Calculator.java Sat Oct 15 13:34:54 2016 @@ -43,6 +43,8 @@ public class Calculator { private long bytes = 0; + private long sentBytes = 0; + private long maximum = Long.MIN_VALUE; private long minimum = Long.MAX_VALUE; @@ -51,6 +53,10 @@ public class Calculator { private final String label; + private long startTime = 0; + + private long elapsedTime = 0; + public Calculator() { this(""); } @@ -67,11 +73,16 @@ public class Calculator { mean = 0; deviation = 0; count = 0; + bytes = 0; + sentBytes = 0; + errors = 0; + startTime = 0; + elapsedTime = 0; } /** * Add the value for (possibly multiple) samples. - * Updates the count, sum, min, max, sumOfSqaures, mean and deviation. + * Updates the count, sum, min, max, sumOfSquares, mean and deviation. * * @param newValue the total value for all the samples. * @param sampleCount number of samples included in the value @@ -96,21 +107,14 @@ public class Calculator { deviation = Math.sqrt((sumOfSquares / count) - (mean * mean)); } - - public void addBytes(long newValue) { - bytes += newValue; - } - - private long startTime = 0; - private long elapsedTime = 0; - /** * Add details for a sample result, which may consist of multiple samples. - * Updates the number of bytes read, error count, startTime and elapsedTime + * Updates the number of bytes read and sent, error count, startTime and elapsedTime * @param res the sample result; might represent multiple values */ public void addSample(SampleResult res) { addBytes(res.getBytesAsLong()); + addSentBytes(res.getSentBytes()); addValue(res.getTime(),res.getSampleCount()); errors+=res.getErrorCount(); // account for multiple samples if (startTime == 0){ // not yet intialised @@ -120,7 +124,22 @@ public class Calculator { } elapsedTime = Math.max(elapsedTime, res.getEndTime()-startTime); } + + /** + * add received bytes + * @param value received bytes + */ + public void addBytes(long newValue) { + bytes += newValue; + } + /** + * add Sent bytes + * @param value sent bytes + */ + private void addSentBytes(long value) { + sentBytes += value; + } public long getTotalBytes() { return bytes; @@ -181,11 +200,7 @@ public class Calculator { * @return throughput associated to this sampler in requests per second */ public double getRate() { - if (elapsedTime == 0) { - return 0.0; - } - - return ((double) count / (double) elapsedTime ) * 1000; + return getRatePerSecond(count); } /** @@ -207,19 +222,46 @@ public class Calculator { * @return throughput in bytes/second */ public double getBytesPerSecond() { - if (elapsedTime > 0) { - return bytes / ((double) elapsedTime / 1000); // 1000 = millisecs/sec - } - return 0.0; + return getRatePerSecond(bytes); } - + /** - * Throughput in kilobytes / second + * Sent Throughput in kilobytes / second * - * @return Throughput in kilobytes / second + * @return Sent Throughput in kilobytes / second */ public double getKBPerSecond() { return getBytesPerSecond() / 1024; // 1024=bytes per kb } + + /** + * Sent bytes / second + * + * @return throughput in bytes/second + */ + public double getSentBytesPerSecond() { + return getRatePerSecond(sentBytes); + } + + /** + * Sent bytes throughput in kilobytes / second + * + * @return Throughput in kilobytes / second + */ + public double getSentKBPerSecond() { + return getSentBytesPerSecond() / 1024; // 1024=bytes per kb + } + + /** + * + * @param value value for which we compute rate + * @return double rate + */ + private double getRatePerSecond(long value) { + if (elapsedTime > 0) { + return value / ((double) elapsedTime / 1000); // 1000 = millisecs/sec + } + return 0.0; + } } Modified: jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java Sat Oct 15 13:34:54 2016 @@ -102,10 +102,35 @@ public class SamplingStatCalculator { * @return throughput in bytes/second */ public double getBytesPerSecond() { - // Code duplicated from getPageSize() + return getRatePerSecond(calculator.getTotalBytes()); + } + + /** + * Throughput in kilobytes / second + * + * @return Throughput in kilobytes / second + */ + public double getKBPerSecond() { + return getBytesPerSecond() / 1024; // 1024=bytes per kb + } + + /** + * Sent Throughput in bytes / second + * + * @return sent throughput in bytes/second + */ + public double getSentBytesPerSecond() { + return getRatePerSecond(calculator.getTotalSentBytes()); + } + + /** + * @param value long + * @return rate per second + */ + private double getRatePerSecond(long value) { double rate = 0; - if (this.getElapsed() > 0 && calculator.getTotalBytes() > 0) { - rate = calculator.getTotalBytes() / ((double) this.getElapsed() / 1000); + if (this.getElapsed() > 0 && value > 0) { + rate = value / ((double) this.getElapsed() / 1000); } if (rate < 0) { rate = 0; @@ -114,12 +139,12 @@ public class SamplingStatCalculator { } /** - * Throughput in kilobytes / second + * Sent Throughput in kilobytes / second * - * @return Throughput in kilobytes / second + * @return Sent Throughput in kilobytes / second */ - public double getKBPerSecond() { - return getBytesPerSecond() / 1024; // 1024=bytes per kb + public double getSentKBPerSecond() { + return getSentBytesPerSecond() / 1024; // 1024=bytes per kb } /** @@ -158,6 +183,7 @@ public class SamplingStatCalculator { synchronized (calculator) { calculator.addValue(res.getTime(), res.getSampleCount()); calculator.addBytes(res.getBytesAsLong()); + calculator.addSentBytes(res.getSentBytes()); setStartTime(res); eCount = getCurrentSample().getErrorCount(); eCount += res.getErrorCount(); Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java (original) +++ jmeter/trunk/src/jorphan/org/apache/jorphan/math/StatCalculator.java Sat Oct 15 13:34:54 2016 @@ -55,6 +55,8 @@ public abstract class StatCalculator<T e private T max; private long bytes = 0; + + private long sentBytes = 0; private final T ZERO; @@ -86,14 +88,26 @@ public abstract class StatCalculator<T e deviation = 0; count = 0; bytes = 0; + sentBytes = 0; max = MIN_VALUE; min = MAX_VALUE; } - + /** + * Add to received bytes + * @param newValue + */ public void addBytes(long newValue) { bytes += newValue; } + + /** + * Add to sent bytes + * @param newValue + */ + public void addSentBytes(long newValue) { + sentBytes += newValue; + } public void addAll(StatCalculator<T> calc) { for(Entry<T, MutableLong> ent : calc.valuesMap.entrySet()) { @@ -108,6 +122,10 @@ public abstract class StatCalculator<T e public long getTotalBytes() { return bytes; } + + public long getTotalSentBytes() { + return sentBytes; + } /** * Get the value which %percent% of the values are less than. This works Modified: jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Oct 15 13:34:54 2016 @@ -126,6 +126,7 @@ Summary <li><bug>59975</bug>View Results Tree : Text renderer annoyingly scrolls down when content is bulky. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li> <li><bug>60109</bug>Summariser : Make it ignore TC generated SampleResult in its summary computations</li> <li><bug>59948</bug>Add a formatted and sane HTML source code render to View Results Tree</li> + <li><bug>60252</bug>Add sent kbytes/s to Aggregate Report and Summary report</li> </ul> <h3>Timers, Assertions, Config, Pre- & Post-Processors</h3> Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1765062&r1=1765061&r2=1765062&view=diff ============================================================================== --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original) +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Oct 15 13:34:54 2016 @@ -3017,7 +3017,8 @@ The time unit is chosen so that the disp When the throughput is saved to a CSV file, it is expressed in requests/second, i.e. 30.0 requests/minute is saved as 0.5. </li> -<li><code>Kb/sec</code> - The throughput measured in Kilobytes per second</li> +<li><code>Received KB/sec</code> - The throughput measured in received Kilobytes per second</li> +<li><code>Sent KB/sec</code> - The throughput measured in sent Kilobytes per second</li> </ul> <p>Times are in milliseconds.</p> </description> @@ -3250,7 +3251,8 @@ The time unit is chosen so that the disp When the throughput is saved to a CSV file, it is expressed in requests/second, i.e. 30.0 requests/minute is saved as <code>0.5</code>. </li> -<li><code>Kb/sec</code> - The throughput measured in Kilobytes per second</li> +<li><code>Received KB/sec</code> - The throughput measured in Kilobytes per second</li> +<li><code>Sent KB/sec</code> - The throughput measured in Kilobytes per second</li> <li><code>Avg. Bytes</code> - average size of the sample response in bytes.</li> </ul> <p>Times are in milliseconds.</p>