MediaWiki master
SectionProfileCallback.php
Go to the documentation of this file.
1<?php
20use Wikimedia\ScopedCallback;
21
28class SectionProfileCallback extends ScopedCallback {
29
31 protected string $section;
32
37 public function __construct( SectionProfiler $profiler, string $section ) {
38 parent::__construct( null );
39 $this->profiler = $profiler;
40 $this->section = $section;
41 }
42
43 public function __destruct() {
44 $this->profiler->profileOutInternal( $this->section );
45 }
46}
Subclass ScopedCallback to avoid call_user_func_array(), which is slow.
__construct(SectionProfiler $profiler, string $section)
Arbitrary section name based PHP profiling.