Skip to content

TimingsHandler ​

class · pocketmine\timings\TimingsHandler · source

Methods ​

__construct() ​

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

createReportFile() ​

php
public static function createReportFile(string $directory, ?string $fileName = null) : \pocketmine\promise\Promise

Creates a timings report file locally in the provided file path. Collects timings data and returns a promise that resolves with the created file.

getCollectCallbacks() ​

php
public static function getCollectCallbacks() : \pocketmine\utils\ObjectSet

getGroup() ​

php
public function getGroup() : string

getName() ​

php
public function getName() : string

getReloadCallbacks() ​

php
public static function getReloadCallbacks() : \pocketmine\utils\ObjectSet

getStartTime() ​

php
public static function getStartTime() : float

getToggleCallbacks() ​

php
public static function getToggleCallbacks() : \pocketmine\utils\ObjectSet

isEnabled() ​

php
public static function isEnabled() : bool

now() 5.46.0 ​

php
public static function now() : int

Monotonic clock in nanoseconds (arbitrary origin), like hrtime(true). hrtime() costs several microseconds on virtual machines without a paravirtualised clock, more than most timed sections; when the chunkutils2 extension provides the CPU time stamp counter it is used instead (a few nanoseconds per read), calibrated against hrtime() once per thread.

printCurrentThreadRecords() ​

php
public static function printCurrentThreadRecords() : array

printTimings() ​

php
public static function printTimings() : array

Deprecated

This only collects timings from the main thread. Collecting timings from all threads is an async

reload() ​

php
public static function reload() : void

requestPrintTimings() ​

php
public static function requestPrintTimings() : \pocketmine\promise\Promise

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.

setEnabled() ​

php
public static function setEnabled(bool $enable = true) : void

startTiming() ​

php
public function startTiming() : void

stopTiming() ​

php
public function stopTiming() : void

tick() ​

php
public static function tick(bool $measure = true) : void

time() ​

php
public function time(\Closure $closure)

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.