mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
CrashDump: Added JIT mode to data
this is necessary for identifying JIT-specific bugs, which, unfortunately, are very common.
This commit is contained in:
parent
1ffd38b37b
commit
0e73ffe555
@ -71,16 +71,10 @@ class VersionCommand extends VanillaCommand{
|
|||||||
));
|
));
|
||||||
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpVersion(PHP_VERSION));
|
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpVersion(PHP_VERSION));
|
||||||
|
|
||||||
if(
|
$jitMode = Utils::getOpcacheJitMode();
|
||||||
function_exists('opcache_get_status') &&
|
if($jitMode !== null){
|
||||||
($opcacheStatus = opcache_get_status(false)) !== false &&
|
if($jitMode !== 0){
|
||||||
isset($opcacheStatus["jit"]["on"])
|
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(sprintf("CRTO: %d", $jitMode));
|
||||||
){
|
|
||||||
$jit = $opcacheStatus["jit"];
|
|
||||||
if($jit["on"] === true){
|
|
||||||
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(
|
|
||||||
sprintf("CRTO: %s%s%s%s", $jit["opt_flags"] >> 2, $jit["opt_flags"] & 0x03, $jit["kind"], $jit["opt_level"])
|
|
||||||
);
|
|
||||||
}else{
|
}else{
|
||||||
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitDisabled();
|
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitDisabled();
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,8 @@ class CrashDump{
|
|||||||
}
|
}
|
||||||
$this->data->extensions = $extensions;
|
$this->data->extensions = $extensions;
|
||||||
|
|
||||||
|
$this->data->jit_mode = Utils::getOpcacheJitMode();
|
||||||
|
|
||||||
if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-phpinfo", true)){
|
if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-phpinfo", true)){
|
||||||
ob_start();
|
ob_start();
|
||||||
phpinfo();
|
phpinfo();
|
||||||
|
@ -66,6 +66,8 @@ final class CrashDumpData implements \JsonSerializable{
|
|||||||
*/
|
*/
|
||||||
public array $extensions = [];
|
public array $extensions = [];
|
||||||
|
|
||||||
|
public ?int $jit_mode = null;
|
||||||
|
|
||||||
public string $phpinfo = "";
|
public string $phpinfo = "";
|
||||||
|
|
||||||
public CrashDumpDataGeneral $general;
|
public CrashDumpDataGeneral $general;
|
||||||
|
@ -69,6 +69,7 @@ use function mb_check_encoding;
|
|||||||
use function ob_end_clean;
|
use function ob_end_clean;
|
||||||
use function ob_get_contents;
|
use function ob_get_contents;
|
||||||
use function ob_start;
|
use function ob_start;
|
||||||
|
use function opcache_get_status;
|
||||||
use function ord;
|
use function ord;
|
||||||
use function php_uname;
|
use function php_uname;
|
||||||
use function phpversion;
|
use function phpversion;
|
||||||
@ -78,6 +79,7 @@ use function preg_match_all;
|
|||||||
use function preg_replace;
|
use function preg_replace;
|
||||||
use function shell_exec;
|
use function shell_exec;
|
||||||
use function spl_object_id;
|
use function spl_object_id;
|
||||||
|
use function sprintf;
|
||||||
use function str_pad;
|
use function str_pad;
|
||||||
use function str_split;
|
use function str_split;
|
||||||
use function stripos;
|
use function stripos;
|
||||||
@ -634,4 +636,30 @@ final class Utils{
|
|||||||
public static function checkLocationNotInfOrNaN(Location $location) : void{
|
public static function checkLocationNotInfOrNaN(Location $location) : void{
|
||||||
self::checkVector3NotInfOrNaN($location);
|
self::checkVector3NotInfOrNaN($location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an integer describing the current OPcache JIT setting.
|
||||||
|
* @see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
|
||||||
|
*/
|
||||||
|
public static function getOpcacheJitMode() : ?int{
|
||||||
|
if(
|
||||||
|
function_exists('opcache_get_status') &&
|
||||||
|
($opcacheStatus = opcache_get_status(false)) !== false &&
|
||||||
|
isset($opcacheStatus["jit"]["on"])
|
||||||
|
){
|
||||||
|
$jit = $opcacheStatus["jit"];
|
||||||
|
if($jit["on"] === true){
|
||||||
|
return (($jit["opt_flags"] >> 2) * 1000) +
|
||||||
|
(($jit["opt_flags"] & 0x03) * 100) +
|
||||||
|
($jit["kind"] * 10) +
|
||||||
|
$jit["opt_level"];
|
||||||
|
}
|
||||||
|
|
||||||
|
//jit available, but disabled
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//jit not available
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user