Timings: rename core timers to remove 'timer' from the names

this makes them shorter and more consistent.
This commit is contained in:
Dylan K. Taylor
2020-12-23 17:52:25 +00:00
parent 1d7b65e0c2
commit bcc3e87730
14 changed files with 160 additions and 160 deletions

View File

@ -316,25 +316,25 @@ class NetworkSession{
}
if($this->cipher !== null){
Timings::$playerNetworkReceiveDecryptTimer->startTiming();
Timings::$playerNetworkReceiveDecrypt->startTiming();
try{
$payload = $this->cipher->decrypt($payload);
}catch(DecryptionException $e){
$this->logger->debug("Encrypted packet: " . base64_encode($payload));
throw BadPacketException::wrap($e, "Packet decryption error");
}finally{
Timings::$playerNetworkReceiveDecryptTimer->stopTiming();
Timings::$playerNetworkReceiveDecrypt->stopTiming();
}
}
Timings::$playerNetworkReceiveDecompressTimer->startTiming();
Timings::$playerNetworkReceiveDecompress->startTiming();
try{
$stream = new PacketBatch($this->compressor->decompress($payload));
}catch(DecompressionException $e){
$this->logger->debug("Failed to decompress packet: " . base64_encode($payload));
throw BadPacketException::wrap($e, "Compressed packet batch decode error");
}finally{
Timings::$playerNetworkReceiveDecompressTimer->stopTiming();
Timings::$playerNetworkReceiveDecompress->stopTiming();
}
try{
@ -484,9 +484,9 @@ class NetworkSession{
private function sendEncoded(string $payload, bool $immediate = false) : void{
if($this->cipher !== null){
Timings::$playerNetworkSendEncryptTimer->startTiming();
Timings::$playerNetworkSendEncrypt->startTiming();
$payload = $this->cipher->encrypt($payload);
Timings::$playerNetworkSendEncryptTimer->stopTiming();
Timings::$playerNetworkSendEncrypt->stopTiming();
}
$this->sender->send($payload, $immediate);
}
@ -859,12 +859,12 @@ class NetworkSession{
$this->logger->debug("Tried to send no-longer-active chunk $chunkX $chunkZ in world " . $world->getFolderName());
return;
}
$currentWorld->timings->syncChunkSendTimer->startTiming();
$currentWorld->timings->syncChunkSend->startTiming();
try{
$this->queueCompressed($promise);
$onCompletion($chunkX, $chunkZ);
}finally{
$currentWorld->timings->syncChunkSendTimer->stopTiming();
$currentWorld->timings->syncChunkSend->stopTiming();
}
}
);

View File

@ -107,7 +107,7 @@ class ChunkCache implements ChunkListener{
++$this->misses;
$this->world->timings->syncChunkSendPrepareTimer->startTiming();
$this->world->timings->syncChunkSendPrepare->startTiming();
try{
$this->caches[$chunkHash] = new CompressBatchPromise();
@ -128,7 +128,7 @@ class ChunkCache implements ChunkListener{
return $this->caches[$chunkHash];
}finally{
$this->world->timings->syncChunkSendPrepareTimer->stopTiming();
$this->world->timings->syncChunkSendPrepare->stopTiming();
}
}

View File

@ -67,7 +67,7 @@ final class CraftingDataCache{
* Rebuilds the cached CraftingDataPacket.
*/
private function buildCraftingDataCache(CraftingManager $manager) : CraftingDataPacket{
Timings::$craftingDataCacheRebuildTimer->startTiming();
Timings::$craftingDataCacheRebuild->startTiming();
$pk = new CraftingDataPacket();
$pk->cleanRecipes = true;
@ -127,7 +127,7 @@ final class CraftingDataCache{
);
}
Timings::$craftingDataCacheRebuildTimer->stopTiming();
Timings::$craftingDataCacheRebuild->stopTiming();
return $pk;
}
}