diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-07 21:25:34 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-08 11:40:15 +0300 |
commit | d68a8945805bbddcf68b57e9b23edde308270798 (patch) | |
tree | c9cc9aefe9ab813166337b1c7a0fc89890137022 /lib/IMAP | |
parent | 9f77500c3cd41872b0e4b53c7a7121c2b5cd45c2 (diff) |
Add performance logging to threading
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/IMAP')
-rw-r--r-- | lib/IMAP/Threading/ThreadBuilder.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/IMAP/Threading/ThreadBuilder.php b/lib/IMAP/Threading/ThreadBuilder.php index 1667fcc35..97e787adb 100644 --- a/lib/IMAP/Threading/ThreadBuilder.php +++ b/lib/IMAP/Threading/ThreadBuilder.php @@ -25,32 +25,48 @@ declare(strict_types=1); namespace OCA\Mail\IMAP\Threading; +use OCA\Mail\Support\PerformanceLogger; use function array_key_exists; use function count; class ThreadBuilder { + /** @var PerformanceLogger */ + private $performanceLogger; + + public function __construct(PerformanceLogger $performanceLogger) { + $this->performanceLogger = $performanceLogger; + } + /** * @param Message[] $messages * * @return Container[] */ public function build(array $messages): array { + $log = $this->performanceLogger->start('Threading ' . count($messages) . ' messages'); + // Step 1 $idTable = $this->buildIdTable($messages); + $log->step('build ID table'); // Step 2 $rootContainer = $this->buildRootContainer($idTable); + $log->step('build root container'); // Step 3 unset($idTable); + $log->step('free ID table'); // Step 4 $this->pruneContainers($rootContainer); + $log->step('prune containers'); // Step 5 $this->groupBySubject($rootContainer); + $log->step('group by subject'); + $log->end(); // Return the children with reset numeric keys return array_values($rootContainer->getChildren()); } |