Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit a81d280

Browse files
committed
Show memory usage
1 parent 745568c commit a81d280

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/LanguageServerIndexer/Handler/IndexerHandler.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Phpactor\AmpFsWatch\Watcher;
1212
use Phpactor\AmpFsWatch\WatcherProcess;
1313
use Phpactor\Extension\LanguageServerIndexer\Event\IndexReset;
14+
use Phpactor\Indexer\Model\MemoryUsage;
1415
use Phpactor\LanguageServer\Core\Handler\Handler;
1516
use Phpactor\LanguageServer\Core\Server\ClientApi;
1617
use Phpactor\Indexer\Model\Indexer;
@@ -109,11 +110,13 @@ public function indexer(CancellationToken $cancel): Promise
109110
$index++;
110111

111112
if ($index % 500 === 0) {
113+
$usage = MemoryUsage::create();
112114
$this->clientApi->window()->showMessage()->info(sprintf(
113-
'Indexed %s/%s (%s%%)',
115+
'Indexed %s/%s (%s%%) %s',
114116
$index,
115117
$size,
116-
number_format($index / $size * 100, 2)
118+
number_format($index / $size * 100, 2),
119+
$usage->memoryUsageFormatted()
117120
));
118121
}
119122

@@ -128,8 +131,9 @@ public function indexer(CancellationToken $cancel): Promise
128131

129132
$process = yield $this->watcher->watch();
130133
$this->clientApi->window()->showMessage()->info(sprintf(
131-
'Done indexing (%ss), watching with %s',
134+
'Done indexing (%ss, %s), watching with %s',
132135
number_format(microtime(true) - $start, 2),
136+
MemoryUsage::create()->memoryUsageFormatted(),
133137
$this->watcher->describe()
134138
));
135139

0 commit comments

Comments
 (0)