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
33 public function __construct( SectionProfiler $profiler, string $section ) {
34 parent::__construct( null );
35 $this->profiler = $profiler;
36 $this->section = $section;
37 }
38
39 public function __destruct() {
40 $this->profiler->profileOutInternal( $this->section );
41 }
42}
Subclass ScopedCallback to avoid call_user_func_array(), which is slow.
__construct(SectionProfiler $profiler, string $section)
Arbitrary section name based PHP profiling.