mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 21:59:52 +00:00
Added AsyncTasks timings
This commit is contained in:
parent
529f9b148b
commit
d4cae729c3
@ -105,6 +105,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
$this->nameTag = $this->namedtag["NameTag"];
|
$this->nameTag = $this->namedtag["NameTag"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($this->namedtag->Inventory) and $this->namedtag->Inventory instanceof Enum){
|
||||||
foreach($this->namedtag->Inventory as $item){
|
foreach($this->namedtag->Inventory as $item){
|
||||||
if($item["Slot"] >= 0 and $item["Slot"] < 9){ //Hotbar
|
if($item["Slot"] >= 0 and $item["Slot"] < 9){ //Hotbar
|
||||||
$this->inventory->setHotbarSlotIndex($item["Slot"], isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1);
|
$this->inventory->setHotbarSlotIndex($item["Slot"], isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1);
|
||||||
@ -114,6 +115,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
$this->inventory->setItem($item["Slot"] - 9, ItemItem::get($item["id"], $item["Damage"], $item["Count"]));
|
$this->inventory->setItem($item["Slot"] - 9, ItemItem::get($item["id"], $item["Damage"], $item["Count"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){
|
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){
|
||||||
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0);
|
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0);
|
||||||
@ -194,7 +196,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->namedtag->Skin = new Compound("Inventory", [
|
$this->namedtag->Skin = new Compound("Skin", [
|
||||||
"Data" => new String("Data", $this->getSkinData()),
|
"Data" => new String("Data", $this->getSkinData()),
|
||||||
"Slim" => new Byte("Slim", $this->isSkinSlim() ? 1 : 0)
|
"Slim" => new Byte("Slim", $this->isSkinSlim() ? 1 : 0)
|
||||||
]);
|
]);
|
||||||
|
@ -83,6 +83,8 @@ abstract class Timings{
|
|||||||
public static $processQueueTimer;
|
public static $processQueueTimer;
|
||||||
/** @var TimingsHandler */
|
/** @var TimingsHandler */
|
||||||
public static $schedulerSyncTimer;
|
public static $schedulerSyncTimer;
|
||||||
|
/** @var TimingsHandler */
|
||||||
|
public static $schedulerAsyncTimer;
|
||||||
|
|
||||||
/** @var TimingsHandler */
|
/** @var TimingsHandler */
|
||||||
public static $playerCommandTimer;
|
public static $playerCommandTimer;
|
||||||
@ -127,6 +129,7 @@ abstract class Timings{
|
|||||||
|
|
||||||
self::$processQueueTimer = new TimingsHandler("processQueue");
|
self::$processQueueTimer = new TimingsHandler("processQueue");
|
||||||
self::$schedulerSyncTimer = new TimingsHandler("** Scheduler - Sync Tasks", PluginManager::$pluginParentTimer);
|
self::$schedulerSyncTimer = new TimingsHandler("** Scheduler - Sync Tasks", PluginManager::$pluginParentTimer);
|
||||||
|
self::$schedulerAsyncTimer = new TimingsHandler("** Scheduler - Async Tasks");
|
||||||
|
|
||||||
self::$playerCommandTimer = new TimingsHandler("** playerCommand");
|
self::$playerCommandTimer = new TimingsHandler("** playerCommand");
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
namespace pocketmine\scheduler;
|
namespace pocketmine\scheduler;
|
||||||
|
|
||||||
|
use pocketmine\event\Timings;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
|
|
||||||
class AsyncPool{
|
class AsyncPool{
|
||||||
@ -113,6 +114,8 @@ class AsyncPool{
|
|||||||
unset($this->taskWorkers[$task->getTaskId()]);
|
unset($this->taskWorkers[$task->getTaskId()]);
|
||||||
|
|
||||||
$task->cleanObject();
|
$task->cleanObject();
|
||||||
|
|
||||||
|
unset($task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeTasks(){
|
public function removeTasks(){
|
||||||
@ -129,6 +132,8 @@ class AsyncPool{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function collectTasks(){
|
public function collectTasks(){
|
||||||
|
Timings::$schedulerAsyncTimer->startTiming();
|
||||||
|
|
||||||
foreach($this->tasks as $task){
|
foreach($this->tasks as $task){
|
||||||
if($task->isGarbage()){
|
if($task->isGarbage()){
|
||||||
|
|
||||||
@ -142,5 +147,7 @@ class AsyncPool{
|
|||||||
$this->server->getLogger()->critical("On ".$info["scope"].", line ".$info["line"] .", ".$info["function"]."()");
|
$this->server->getLogger()->critical("On ".$info["scope"].", line ".$info["line"] .", ".$info["function"]."()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timings::$schedulerAsyncTimer->stopTiming();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user