jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1760157 - in /jmeter/trunk: bin/report-template/content/js/dashboard-commons.js bin/report-template/content/js/dashboard.js.fmkr xdocs/changes.xml
Date Sat, 10 Sep 2016 12:48:25 GMT
Author: pmouawad
Date: Sat Sep 10 12:48:25 2016
New Revision: 1760157

URL: http://svn.apache.org/viewvc?rev=1760157&view=rev
Log:
Bug 60108 - Report / Dashboard : In Requests Summary rounding is too aggressive
Bugzilla Id: 60108

Modified:
    jmeter/trunk/bin/report-template/content/js/dashboard-commons.js
    jmeter/trunk/bin/report-template/content/js/dashboard.js.fmkr
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/report-template/content/js/dashboard-commons.js
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/js/dashboard-commons.js?rev=1760157&r1=1760156&r2=1760157&view=diff
==============================================================================
--- jmeter/trunk/bin/report-template/content/js/dashboard-commons.js (original)
+++ jmeter/trunk/bin/report-template/content/js/dashboard-commons.js Sat Sep 10 12:48:25 2016
@@ -14,6 +14,60 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 */
+
+/**
+ * From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/round
+ * Licensed under https://creativecommons.org/licenses/by-sa/2.5/
+ */
+// Closure
+(function() {
+  /**
+   * Decimal adjustment of a number.
+   *
+   * @param {String}  type  The type of adjustment.
+   * @param {Number}  value The number.
+   * @param {Integer} exp   The exponent (the 10 logarithm of the adjustment base).
+   * @returns {Number} The adjusted value.
+   */
+  function decimalAdjust(type, value, exp) {
+    // If the exp is undefined or zero...
+    if (typeof exp === 'undefined' || +exp === 0) {
+      return Math[type](value);
+    }
+    value = +value;
+    exp = +exp;
+    // If the value is not a number or the exp is not an integer...
+    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
+      return NaN;
+    }
+    // Shift
+    value = value.toString().split('e');
+    value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
+    // Shift back
+    value = value.toString().split('e');
+    return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
+  }
+
+  // Decimal round
+  if (!Math.round10) {
+    Math.round10 = function(value, exp) {
+      return decimalAdjust('round', value, exp);
+    };
+  }
+  // Decimal floor
+  if (!Math.floor10) {
+    Math.floor10 = function(value, exp) {
+      return decimalAdjust('floor', value, exp);
+    };
+  }
+  // Decimal ceil
+  if (!Math.ceil10) {
+    Math.ceil10 = function(value, exp) {
+      return decimalAdjust('ceil', value, exp);
+    };
+  }
+})();
+
 /*
  * Suffixes the specified value with a unit
  * The spaced argument defines whether a space character is introduced.

Modified: jmeter/trunk/bin/report-template/content/js/dashboard.js.fmkr
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/js/dashboard.js.fmkr?rev=1760157&r1=1760156&r2=1760157&view=diff
==============================================================================
--- jmeter/trunk/bin/report-template/content/js/dashboard.js.fmkr (original)
+++ jmeter/trunk/bin/report-template/content/js/dashboard.js.fmkr Sat Sep 10 12:48:25 2016
@@ -110,7 +110,7 @@ $(document).ready(function() {
                         return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'
                             + label
                             + '<br/>'
-                            + Math.round(series.percent)
+                            + Math.round10(series.percent, -2)
                             + '%</div>';
                     },
                     background : {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1760157&r1=1760156&r2=1760157&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep 10 12:48:25 2016
@@ -142,6 +142,7 @@ Summary
     <li><bug>60080</bug>Report / Dashboard : Add a new "Connect Time Over
Time " graph. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>60091</bug>Report / Dashboard : Have a new report containing
min/max and percentiles graphs.</li>
     <li><bug>60085</bug>Remove cache for prepared statements, as it didn't
work with the current jdbc pool implementation and current jdbc drivers should support caching
of prepared statements themselves.</li>
+    <li><bug>60108</bug>Report / Dashboard : In Requests Summary rounding
is too aggressive</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message