PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
pocketmine\timings\TimingsHandler Class Reference
+ Collaboration diagram for pocketmine\timings\TimingsHandler:

Public Member Functions

 __construct (private string $name, private ?TimingsHandler $parent=null, private string $group=Timings::GROUP_MINECRAFT)
 
 getGroup ()
 
 getName ()
 
 reset ()
 
 startTiming ()
 
 stopTiming ()
 
 time (\Closure $closure)
 

Static Public Member Functions

static getCollectCallbacks ()
 
static getReloadCallbacks ()
 
static getStartTime ()
 
static getToggleCallbacks ()
 
static isEnabled ()
 
static printCurrentThreadRecords ()
 
static printTimings ()
 
static reload ()
 
static requestPrintTimings ()
 
static setEnabled (bool $enable=true)
 
static tick (bool $measure=true)
 

Detailed Description

@phpstan-type CollectPromise Promise<list<string>>

Definition at line 41 of file TimingsHandler.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\timings\TimingsHandler::__construct ( private string $name,
private ?TimingsHandler $parent = null,
private string $group = Timings::GROUP_MINECRAFT )

Definition at line 241 of file TimingsHandler.php.

Member Function Documentation

◆ getCollectCallbacks()

static pocketmine\timings\TimingsHandler::getCollectCallbacks ( )
static

@phpstan-return ObjectSet<\Closure() : list<CollectPromise>>

Definition at line 78 of file TimingsHandler.php.

◆ getGroup()

pocketmine\timings\TimingsHandler::getGroup ( )

Definition at line 249 of file TimingsHandler.php.

◆ getName()

pocketmine\timings\TimingsHandler::getName ( )

Definition at line 247 of file TimingsHandler.php.

◆ getReloadCallbacks()

static pocketmine\timings\TimingsHandler::getReloadCallbacks ( )
static

@phpstan-return ObjectSet<\Closure() : void>

Definition at line 73 of file TimingsHandler.php.

◆ getStartTime()

static pocketmine\timings\TimingsHandler::getStartTime ( )
static

Definition at line 206 of file TimingsHandler.php.

◆ getToggleCallbacks()

static pocketmine\timings\TimingsHandler::getToggleCallbacks ( )
static

@phpstan-return ObjectSet<\Closure(bool $enable) : void>

Definition at line 68 of file TimingsHandler.php.

◆ isEnabled()

static pocketmine\timings\TimingsHandler::isEnabled ( )
static

Definition at line 189 of file TimingsHandler.php.

◆ printCurrentThreadRecords()

static pocketmine\timings\TimingsHandler::printCurrentThreadRecords ( )
static
Returns
string[] @phpstan-return list<string>

Definition at line 84 of file TimingsHandler.php.

◆ printTimings()

static pocketmine\timings\TimingsHandler::printTimings ( )
static
Deprecated
This only collects timings from the main thread. Collecting timings from all threads is an async operation, so it can't be done synchronously.
Returns
string[]

Definition at line 147 of file TimingsHandler.php.

◆ reload()

static pocketmine\timings\TimingsHandler::reload ( )
static

Definition at line 217 of file TimingsHandler.php.

◆ requestPrintTimings()

static pocketmine\timings\TimingsHandler::requestPrintTimings ( )
static

Collects timings asynchronously, allowing timings from multiple threads to be aggregated into a single report.

NOTE: You need to add a callback to collectCallbacks if you want to include timings from other threads. They won't be automatically collected if you don't, since the main thread has no way to access them.

This is an asynchronous operation, and the result is returned as a promise. The caller must add a callback to the returned promise to get the complete timings report.

@phpstan-return Promise<list<string>>

Definition at line 165 of file TimingsHandler.php.

◆ reset()

pocketmine\timings\TimingsHandler::reset ( )

Definition at line 328 of file TimingsHandler.php.

◆ setEnabled()

static pocketmine\timings\TimingsHandler::setEnabled ( bool $enable = true)
static

Definition at line 193 of file TimingsHandler.php.

◆ startTiming()

pocketmine\timings\TimingsHandler::startTiming ( )

Definition at line 251 of file TimingsHandler.php.

◆ stopTiming()

pocketmine\timings\TimingsHandler::stopTiming ( )

Definition at line 280 of file TimingsHandler.php.

◆ tick()

static pocketmine\timings\TimingsHandler::tick ( bool $measure = true)
static

Definition at line 226 of file TimingsHandler.php.

◆ time()

pocketmine\timings\TimingsHandler::time ( \Closure $closure)
Returns
mixed the result of the given closure

@phpstan-template TClosureReturn @phpstan-param \Closure() : TClosureReturn $closure @phpstan-return TClosureReturn

Definition at line 316 of file TimingsHandler.php.


The documentation for this class was generated from the following file: