MediaWiki master
SectionProfileCallback.php
Go to the documentation of this file.
1<?php
6use Wikimedia\ScopedCallback;
7
14class SectionProfileCallback extends ScopedCallback {
15
17 protected string $section;
18
19 public function __construct( SectionProfiler $profiler, string $section ) {
20 parent::__construct( null );
21 $this->profiler = $profiler;
22 $this->section = $section;
23 }
24
25 public function __destruct() {
26 $this->profiler->profileOutInternal( $this->section );
27 }
28}
Subclass ScopedCallback to avoid call_user_func_array(), which is slow.
__construct(SectionProfiler $profiler, string $section)
Arbitrary section name based PHP profiling.