rebaseline_server: display how long it took to render the list
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 10 Mar 2014 15:36:06 +0000 (15:36 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 10 Mar 2014 15:36:06 +0000 (15:36 +0000)
BUG=skia:2248
NOTREECHECKS=True
NOTRY=True
R=borenet@google.com

Author: epoger@google.com

Review URL: https://codereview.chromium.org/189833008

git-svn-id: http://skia.googlecode.com/svn/trunk@13720 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/rebaseline_server/static/loader.js
gm/rebaseline_server/static/view.html

index 9926193..254d0fd 100644 (file)
@@ -8,6 +8,21 @@ var Loader = angular.module(
     ['ConstantsModule', 'diff_viewer']
 );
 
+Loader.directive(
+  'resultsUpdatedCallbackDirective',
+  ['$timeout',
+   function($timeout) {
+     return function(scope, element, attrs) {
+       if (scope.$last) {
+         $timeout(function() {
+           scope.resultsUpdatedCallback();
+         });
+       }
+     };
+   }
+  ]
+);
+
 // TODO(epoger): Combine ALL of our filtering operations (including
 // truncation) into this one filter, so that runs most efficiently?
 // (We would have to make sure truncation still took place after
@@ -44,7 +59,7 @@ Loader.filter(
 
 Loader.controller(
   'Loader.Controller',
-    function($scope, $http, $filter, $location, $timeout, constants) {
+    function($scope, $http, $filter, $location, $log, $timeout, constants) {
     $scope.constants = constants;
     $scope.windowTitle = "Loading GM Results...";
     $scope.resultsToLoad = $location.search().resultsToLoad;
@@ -77,7 +92,6 @@ Loader.controller(
           $scope.imageSets = data[constants.KEY__IMAGESETS];
           $scope.sortColumnSubdict = constants.KEY__DIFFERENCE_DATA;
           $scope.sortColumnKey = constants.KEY__DIFFERENCE_DATA__WEIGHTED_DIFF;
-          $scope.showTodos = false;
 
           $scope.showSubmitAdvancedSettings = false;
           $scope.submitAdvancedSettings = {};
@@ -357,6 +371,8 @@ Loader.controller(
      * can be bookmarked.
      */
     $scope.updateResults = function() {
+      $scope.renderStartTime = window.performance.now();
+      $log.debug("renderStartTime: " + $scope.renderStartTime);
       $scope.displayLimit = $scope.displayLimitPending;
       // TODO(epoger): Every time we apply a filter, AngularJS creates
       // another copy of the array.  Is there a way we can filter out
@@ -404,6 +420,15 @@ Loader.controller(
     }
 
     /**
+     * This function is called when the results have been completely rendered
+     * after updateResults().
+     */
+    $scope.resultsUpdatedCallback = function() {
+      $scope.renderEndTime = window.performance.now();
+      $log.debug("renderEndTime: " + $scope.renderEndTime);
+    }
+
+    /**
      * Re-sort the displayed results.
      *
      * @param subdict (string): which subdictionary
index a4d15c5..e55544d 100644 (file)
           <td>
             Found {{filteredImagePairs.length}} matches;
             <span ng-show="filteredImagePairs.length > limitedImagePairs.length">
-              displaying the first {{limitedImagePairs.length}}
+              displaying the first {{limitedImagePairs.length}}.
             </span>
             <span ng-show="filteredImagePairs.length <= limitedImagePairs.length">
-              displaying them all
+              displaying them all.
+            </span>
+            <span ng-show="renderEndTime > renderStartTime">
+              Rendered in {{(renderEndTime - renderStartTime).toFixed(0)}} ms.
             </span>
             <br>
             (click on the column header radio buttons to re-sort by that column)
           </th>
         </tr>
 
-        <tr ng-repeat="imagePair in limitedImagePairs" ng-controller="ImageController">
+        <tr ng-repeat="imagePair in limitedImagePairs" ng-controller="ImageController" results-updated-callback-directive>
           <td>
             {{imagePair[constants.KEY__EXTRA_COLUMN_VALUES][constants.KEY__EXTRACOLUMN__RESULT_TYPE]}}
             <br>