mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Improved thread count
This commit is contained in:
parent
2ae80031f0
commit
b5b46bfd7e
@ -1504,7 +1504,6 @@ class Server{
|
|||||||
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [
|
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [
|
||||||
"motd" => "Minecraft: PE Server",
|
"motd" => "Minecraft: PE Server",
|
||||||
"server-port" => 19132,
|
"server-port" => 19132,
|
||||||
"memory-limit" => -1,
|
|
||||||
"white-list" => false,
|
"white-list" => false,
|
||||||
"announce-player-achievements" => true,
|
"announce-player-achievements" => true,
|
||||||
"spawn-protection" => 16,
|
"spawn-protection" => 16,
|
||||||
@ -1558,11 +1557,9 @@ class Server{
|
|||||||
$value = ["M" => 1, "G" => 1024];
|
$value = ["M" => 1, "G" => 1024];
|
||||||
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
||||||
if($real < 128){
|
if($real < 128){
|
||||||
$this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM");
|
$this->logger->warning($this->getName() . " may not work right with less than 128MB of memory");
|
||||||
}
|
}
|
||||||
@ini_set("memory_limit", $memory);
|
@ini_set("memory_limit", $memory);
|
||||||
}else{
|
|
||||||
$this->setConfigString("memory-limit", -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){
|
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){
|
||||||
@ -1854,11 +1851,9 @@ class Server{
|
|||||||
$value = ["M" => 1, "G" => 1024];
|
$value = ["M" => 1, "G" => 1024];
|
||||||
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
||||||
if($real < 256){
|
if($real < 256){
|
||||||
$this->logger->warning($this->getName() . " may not work right with less than 256MB of RAM", true, true, 0);
|
$this->logger->warning($this->getName() . " may not work right with less than 256MB of memory", true, true, 0);
|
||||||
}
|
}
|
||||||
@ini_set("memory_limit", $memory);
|
@ini_set("memory_limit", $memory);
|
||||||
}else{
|
|
||||||
$this->setConfigString("memory-limit", -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){
|
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){
|
||||||
@ -2173,7 +2168,7 @@ class Server{
|
|||||||
"os" => Utils::getOS(),
|
"os" => Utils::getOS(),
|
||||||
"name" => $this->getName(),
|
"name" => $this->getName(),
|
||||||
"memory_total" => $this->getConfigString("memory-limit"),
|
"memory_total" => $this->getConfigString("memory-limit"),
|
||||||
"memory_usage" => memory_get_usage(),
|
"memory_usage" => $this->getMemoryUsage(),
|
||||||
"php_version" => PHP_VERSION,
|
"php_version" => PHP_VERSION,
|
||||||
"version" => $version->get(true),
|
"version" => $version->get(true),
|
||||||
"build" => $version->getBuild(),
|
"build" => $version->getBuild(),
|
||||||
@ -2208,7 +2203,7 @@ class Server{
|
|||||||
echo "\x1b]0;" . $this->getName() . " " .
|
echo "\x1b]0;" . $this->getName() . " " .
|
||||||
$this->getPocketMineVersion() .
|
$this->getPocketMineVersion() .
|
||||||
" | Online " . count($this->players) . "/" . $this->getMaxPlayers() .
|
" | Online " . count($this->players) . "/" . $this->getMaxPlayers() .
|
||||||
" | RAM " . $usage .
|
" | Memory " . $usage .
|
||||||
" | U " . round($this->mainInterface->getUploadUsage() / 1024, 2) .
|
" | U " . round($this->mainInterface->getUploadUsage() / 1024, 2) .
|
||||||
" D " . round($this->mainInterface->getDownloadUsage() / 1024, 2) .
|
" D " . round($this->mainInterface->getDownloadUsage() / 1024, 2) .
|
||||||
" kB/s | TPS " . $this->getTicksPerSecond() .
|
" kB/s | TPS " . $this->getTicksPerSecond() .
|
||||||
@ -2233,7 +2228,7 @@ class Server{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count(ThreadManager::getInstance()->getAll()) + 2;
|
return count(ThreadManager::getInstance()->getAll()) + 3; //RakLib + MainLogger + Main Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@
|
|||||||
|
|
||||||
namespace pocketmine\network\rcon;
|
namespace pocketmine\network\rcon;
|
||||||
|
|
||||||
|
use pocketmine\Thread;
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
|
|
||||||
class RCONInstance extends \Thread{
|
class RCONInstance extends Thread{
|
||||||
public $stop;
|
public $stop;
|
||||||
public $cmd;
|
public $cmd;
|
||||||
public $response;
|
public $response;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user