1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

Log slow linters using service call

Summary:
Following @epriestley suggestion to use PhutilServiceProfiler to log lint as a service call

Test Plan: arc lint

Reviewers: vrana

CC: phunt, aran, epriestley

Differential Revision: https://secure.phabricator.com/D4820
This commit is contained in:
François Deliège 2013-02-04 17:25:37 -08:00
parent 7a67173b97
commit 8be64ec4c6
2 changed files with 15 additions and 1 deletions

View file

@ -161,6 +161,7 @@ phutil_register_library_map(array(
'PhutilLintEngine' => 'lint/engine/PhutilLintEngine.php',
'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php',
'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php',
'TimerEventType' => 'events/constant/TimerEventType.php',
'UnitTestableArcanistLintEngine' => 'lint/engine/UnitTestableArcanistLintEngine.php',
),
'function' =>
@ -288,6 +289,7 @@ phutil_register_library_map(array(
'PhutilLintEngine' => 'ArcanistLintEngine',
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
'PhutilUnitTestEngineTestCase' => 'ArcanistTestCase',
'TimerEventType' => 'PhutilEventType',
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
),
));

View file

@ -230,9 +230,21 @@ abstract class ArcanistLintEngine {
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 {
$linter->lintPath($path);
} catch (Exception $ex) {
$profiler->endServiceCall($call_id, array());
throw $ex;
}
$profiler->endServiceCall($call_id, array());
if ($linter->didStopAllLinters()) {
$this->stopped[$path] = $linter_name;
}