]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Log two times per linter instead of N
authorvrana <jakubv@fb.com>
Fri, 22 Feb 2013 17:21:07 +0000 (09:21 -0800)
committervrana <jakubv@fb.com>
Fri, 22 Feb 2013 17:54:43 +0000 (09:54 -0800)
Summary: This number seems more interesting and it includes time for resolving futures which is the main part of some linters.

Test Plan:
  $ arc --trace lint

Reviewers: fdeliege, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D5075

src/lint/engine/ArcanistLintEngine.php

index 9e99e13aa136ed5ff22635f1e60fe1b4f1afa327..f9cae8afc636ce10faedaac39cecb1bd112c8ed5 100644 (file)
@@ -229,26 +229,27 @@ abstract class ArcanistLintEngine {
         $paths = array_values($paths);
 
         if ($paths) {
-          $linter->willLintPaths($paths);
           $profiler = PhutilServiceProfiler::getInstance();
-          foreach ($paths as $path) {
-            $linter->willLintPath($path);
-            $call_id = $profiler->beginServiceCall(array(
-              'type' => 'lint',
-              'linter' => get_class($linter),
-              'path' => $path,
-              ));
-            try {
+          $call_id = $profiler->beginServiceCall(array(
+            'type' => 'lint',
+            'linter' => get_class($linter),
+            'paths' => $paths,
+          ));
+
+          try {
+            $linter->willLintPaths($paths);
+            foreach ($paths as $path) {
+              $linter->willLintPath($path);
               $linter->lintPath($path);
-            } catch (Exception $ex) {
-              $profiler->endServiceCall($call_id, array());
-              throw $ex;
+              if ($linter->didStopAllLinters()) {
+                $this->stopped[$path] = $linter_name;
+              }
             }
+          } catch (Exception $ex) {
             $profiler->endServiceCall($call_id, array());
-            if ($linter->didStopAllLinters()) {
-              $this->stopped[$path] = $linter_name;
-            }
+            throw $ex;
           }
+          $profiler->endServiceCall($call_id, array());
         }
 
       } catch (Exception $ex) {
@@ -356,8 +357,15 @@ abstract class ArcanistLintEngine {
 
   protected function didRunLinters(array $linters) {
     assert_instances_of($linters, 'ArcanistLinter');
+
+    $profiler = PhutilServiceProfiler::getInstance();
     foreach ($linters as $linter) {
+      $call_id = $profiler->beginServiceCall(array(
+        'type' => 'lint',
+        'linter' => get_class($linter),
+      ));
       $linter->didRunLinters();
+      $profiler->endServiceCall($call_id, array());
     }
   }