mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Fixed TimingsHandler depth not getting reset when timings is disabled
When timings was disabled, internalStopTiming is not called, and timer depth is not decremented. If timings is later reenabled, the next call to internalStartTiming will think the timer is already running, and won't generate any new records for the timer. This has led to broken timings reports with missing Full Server Tick entries, amongst other things.
This commit is contained in:
parent
4caa2c7690
commit
fa715a074a
@ -111,7 +111,7 @@ class TimingsHandler{
|
||||
}
|
||||
|
||||
public static function reload() : void{
|
||||
TimingsRecord::clearRecords();
|
||||
TimingsRecord::reset();
|
||||
if(self::$enabled){
|
||||
self::$timingStart = hrtime(true);
|
||||
}
|
||||
@ -219,8 +219,9 @@ class TimingsHandler{
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function destroyCycles() : void{
|
||||
public function reset() : void{
|
||||
$this->rootRecord = null;
|
||||
$this->recordsByParent = [];
|
||||
$this->timingDepth = 0;
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,12 @@ final class TimingsRecord{
|
||||
|
||||
private static ?self $currentRecord = null;
|
||||
|
||||
public static function clearRecords() : void{
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function reset() : void{
|
||||
foreach(self::$records as $record){
|
||||
$record->handler->destroyCycles();
|
||||
$record->handler->reset();
|
||||
}
|
||||
self::$records = [];
|
||||
self::$currentRecord = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user