mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Fixed incorrect implementation of peak timings
This commit is contained in:
parent
283ff28aa9
commit
fdb3a5b121
@ -32,7 +32,7 @@ use function implode;
|
||||
use function spl_object_id;
|
||||
|
||||
class TimingsHandler{
|
||||
private const FORMAT_VERSION = 1;
|
||||
private const FORMAT_VERSION = 2; //peak timings fix
|
||||
|
||||
private static bool $enabled = false;
|
||||
private static int $timingStart = 0;
|
||||
|
@ -66,9 +66,6 @@ final class TimingsRecord{
|
||||
if($record->curTickTotal > Server::TARGET_NANOSECONDS_PER_TICK){
|
||||
$record->violations += (int) floor($record->curTickTotal / Server::TARGET_NANOSECONDS_PER_TICK);
|
||||
}
|
||||
if($record->curTickTotal > $record->peakTime){
|
||||
$record->peakTime = $record->curTickTotal;
|
||||
}
|
||||
$record->curTickTotal = 0;
|
||||
$record->curCount = 0;
|
||||
$record->ticksActive++;
|
||||
@ -126,7 +123,7 @@ final class TimingsRecord{
|
||||
|
||||
public function getTicksActive() : int{ return $this->ticksActive; }
|
||||
|
||||
public function getPeakTime() : float{ return $this->peakTime; }
|
||||
public function getPeakTime() : int{ return $this->peakTime; }
|
||||
|
||||
public function startTiming(int $now) : void{
|
||||
$this->start = $now;
|
||||
@ -152,6 +149,9 @@ final class TimingsRecord{
|
||||
++$this->curCount;
|
||||
++$this->count;
|
||||
$this->start = 0;
|
||||
if($diff > $this->peakTime){
|
||||
$this->peakTime = $diff;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCurrentRecord() : ?self{
|
||||
|
Loading…
x
Reference in New Issue
Block a user