Added extra chunk sending timings

This commit is contained in:
Shoghi Cervantes 2014-10-29 21:52:27 +01:00
parent d57e37896d
commit c4c374e3fa
2 changed files with 14 additions and 0 deletions

View File

@ -56,6 +56,11 @@ class LevelTimings{
/** @var TimingsHandler */
public $tickEntities;
/** @var TimingsHandler */
public $syncChunkSendTimer;
/** @var TimingsHandler */
public $syncChunkSendPrepareTimer;
/** @var TimingsHandler */
public $syncChunkLoadTimer;
/** @var TimingsHandler */
@ -87,6 +92,9 @@ class LevelTimings{
$this->tileEntityTick = new TimingsHandler("** " . $name . "tileEntityTick");
$this->tileEntityPending = new TimingsHandler("** " . $name . "tileEntityPending");
$this->syncChunkSendTimer = new TimingsHandler("** " . $name . "syncChunkSend");
$this->syncChunkSendPrepareTimer = new TimingsHandler("** " . $name . "syncChunkSendPrepare");
$this->syncChunkLoadTimer = new TimingsHandler("** " . $name . "syncChunkLoad");
$this->syncChunkLoadDataTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Data");
$this->syncChunkLoadStructuresTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Structures");

View File

@ -1694,6 +1694,8 @@ class Level implements ChunkManager, Metadatable{
protected function processChunkRequest(){
if(count($this->chunkSendQueue) > 0){
$this->timings->syncChunkSendTimer->startTiming();
$x = null;
$z = null;
foreach($this->chunkSendQueue as $index => $players){
@ -1711,12 +1713,16 @@ class Level implements ChunkManager, Metadatable{
unset($this->chunkSendQueue[$index]);
}else{
$this->chunkSendTasks[$index] = true;
$this->timings->syncChunkSendPrepareTimer->startTiming();
$task = $this->provider->requestChunkTask($x, $z);
if($task instanceof AsyncTask){
$this->server->getScheduler()->scheduleAsyncTask($task);
}
$this->timings->syncChunkSendPrepareTimer->stopTiming();
}
}
$this->timings->syncChunkSendTimer->stopTiming();
}
}