mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Improved CallbackTask timings data
This commit is contained in:
parent
ff48eb3d4d
commit
11f684d803
@ -1920,6 +1920,7 @@ class Server{
|
||||
$lastLoop = 0;
|
||||
$connectionTimer = Timings::$connectionTimer;
|
||||
while($this->isRunning){
|
||||
//TODO: move this to tick
|
||||
$connectionTimer->startTiming();
|
||||
foreach($this->interfaces as $interface){
|
||||
if($interface->process()){
|
||||
|
@ -45,6 +45,13 @@ class CallbackTask extends Task{
|
||||
$this->args[] = $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return callable
|
||||
*/
|
||||
public function getCallable(){
|
||||
return $this->callable;
|
||||
}
|
||||
|
||||
public function onRun($currentTicks){
|
||||
call_user_func_array($this->callable, $this->args);
|
||||
}
|
||||
|
@ -184,7 +184,18 @@ class ServerScheduler{
|
||||
$period = 1;
|
||||
}
|
||||
|
||||
return $this->handle(new TaskHandler(get_class($task), $task, $this->nextId(), $delay, $period));
|
||||
if($task instanceof CallbackTask){
|
||||
$callable = $task->getCallable();
|
||||
if(is_array($callable)){
|
||||
$taskName = "Callback#" . get_class($callable[0]) . "::" . $callable[1];
|
||||
}else{
|
||||
$taskName = "Callback#" . $callable;
|
||||
}
|
||||
}else{
|
||||
$taskName = get_class($task);
|
||||
}
|
||||
|
||||
return $this->handle(new TaskHandler($taskName, $task, $this->nextId(), $delay, $period));
|
||||
}
|
||||
|
||||
private function handle(TaskHandler $handler){
|
||||
|
Loading…
x
Reference in New Issue
Block a user