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