[LNT] r331967 - Add support for logarithmic scale.

Martin Liska via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 02:04:36 PDT 2018


Author: marxin
Date: Thu May 10 02:04:35 2018
New Revision: 331967

URL: http://llvm.org/viewvc/llvm-project?rev=331967&view=rev
Log:
Add support for logarithmic scale.

Differential Revision: https://reviews.llvm.org/D44010


Modified:
    lnt/trunk/lnt/server/ui/templates/v4_graph.html
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/ui/templates/v4_graph.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_graph.html?rev=331967&r1=331966&r2=331967&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_graph.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_graph.html Thu May 10 02:04:35 2018
@@ -43,8 +43,31 @@ var test_suite_name = "{{ request.view_a
 var db_name = "{{ request.view_args.get('db_name','') }}";
 var graph_plots = {{graph_plots|tojson|safe}};
 var baseline_plots = {{baseline_plots|tojson|safe}};
+var options = {{options|tojson|safe}};
 prefix = "{{request.base_url}}";
 
+transform_fn = function (v) { return v; }
+inverse_transform_fn = function (v) { return v; }
+
+if (options.logarithmic_scale) {
+    transform_fn = function(v) {
+      if (v < 0)
+        return -Math.log10(-v);
+      else if (v > 0)
+        return Math.log10(v);
+      else
+        return 0;
+    }
+    inverse_transform_fn = function(v) {
+      if (v < 0)
+        return -Math.pow(10, -v);
+      else if (v > 0)
+        return Math.pow(10, v);
+      else
+        return 0;
+    }
+}
+
 function init_graph() {
   // Set up the primary graph.
   var graph = $("#graph");
@@ -66,7 +89,10 @@ function init_graph() {
               frameRate: 60 },
       grid : {
         hoverable : true,
-        clickable: true }
+        clickable: true },
+        yaxis: {
+          transform: transform_fn,
+          inverseTransform: inverse_transform_fn }
       };
 
   // Add baseline lines
@@ -207,6 +233,11 @@ function init_page() {
                      {{ 'checked="checked"' if options.show_moving_median else ""}}/></td>
               </tr>
               <tr>
+                <td>Show Logarithmic Scale</td>
+                <td><input type="checkbox" name="logarithmic_scale" value="yes"
+                     {{ 'checked="checked"' if options.logarithmic_scale else ""}}/></td>
+              </tr>
+              <tr>
                 <td>Moving Average/Median Window Size</td>
               </tr>
               {# Split this into a new row to avoid making the dialog wider. #}

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=331967&r1=331966&r2=331967&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Thu May 10 02:04:35 2018
@@ -791,6 +791,9 @@ def v4_graph():
         request.args.get('moving_window_size', 10))
     options['hide_highlight'] = bool(
         request.args.get('hide_highlight'))
+    options['logarithmic_scale'] = bool(
+        request.args.get('logarithmic_scale'))
+
     show_highlight = not options['hide_highlight']
 
     # Load the graph parameters.




More information about the llvm-commits mailing list