PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\TimeTrackingSleeperHandler Class Reference
+ Inheritance diagram for pocketmine\TimeTrackingSleeperHandler:
+ Collaboration diagram for pocketmine\TimeTrackingSleeperHandler:

Public Member Functions

 __construct (private TimingsHandler $timings)
 
 addNotifier (\Closure $handler)
 
 getNotificationProcessingTime ()
 
 processNotifications ()
 
 removeNotifier (int $notifierId)
 
 resetNotificationProcessingTime ()
 
 sleepUntil (float $unixTime)
 
 sleepUntilNotification ()
 

Detailed Description

Custom Snooze sleeper handler which captures notification processing time.

Definition at line 36 of file TimeTrackingSleeperHandler.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\TimeTrackingSleeperHandler::__construct ( private TimingsHandler  $timings)

Definition at line 46 of file TimeTrackingSleeperHandler.php.

Member Function Documentation

◆ addNotifier()

pocketmine\TimeTrackingSleeperHandler::addNotifier ( \Closure  $handler)
Parameters
\Closure$handlerCalled when the notifier wakes the server up, of the signature function() : void @phpstan-param \Closure() : void $handler

Reimplemented from pocketmine\snooze\SleeperHandler.

Definition at line 52 of file TimeTrackingSleeperHandler.php.

◆ getNotificationProcessingTime()

pocketmine\TimeTrackingSleeperHandler::getNotificationProcessingTime ( )

Returns the time in nanoseconds spent processing notifications since the last reset.

Definition at line 66 of file TimeTrackingSleeperHandler.php.

◆ processNotifications()

pocketmine\TimeTrackingSleeperHandler::processNotifications ( )

Processes any notifications from notifiers and calls handlers for received notifications.

Reimplemented from pocketmine\snooze\SleeperHandler.

Definition at line 73 of file TimeTrackingSleeperHandler.php.

◆ removeNotifier()

pocketmine\snooze\SleeperHandler::removeNotifier ( int  $notifierId)
inherited

Removes a callback from the sleeper by its ID. Note that this does not prevent the notifier waking the sleeper up - it just stops the notifier getting actions processed from the main thread.

See also
SleeperHandlerEntry::getNotifierId()

Definition at line 61 of file SleeperHandler.php.

◆ resetNotificationProcessingTime()

pocketmine\TimeTrackingSleeperHandler::resetNotificationProcessingTime ( )

Resets the notification processing time tracker to zero.

Definition at line 71 of file TimeTrackingSleeperHandler.php.

◆ sleepUntil()

pocketmine\snooze\SleeperHandler::sleepUntil ( float  $unixTime)
inherited

Sleeps until the given timestamp. Sleep may be interrupted by notifications, which will be processed before going back to sleep.

Definition at line 77 of file SleeperHandler.php.

◆ sleepUntilNotification()

pocketmine\snooze\SleeperHandler::sleepUntilNotification ( )
inherited

Blocks until notifications are received, then processes notifications. Will not sleep if notifications are already waiting.

Definition at line 94 of file SleeperHandler.php.


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