From 83a6f915d257994e53ee41e8dae944aa76f9c163 Mon Sep 17 00:00:00 2001 From: walkor Date: Sat, 7 Sep 2024 11:19:35 +0800 Subject: [PATCH] Display jit status --- src/Worker.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Worker.php b/src/Worker.php index 02bec977e..2f36a6e70 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -861,16 +861,17 @@ protected static function displayUI(): void if (in_array('-q', $tmpArgv)) { return; } + $jitStatus = function_exists('opcache_get_status') && (opcache_get_status()['jit']['on'] ?? false) === true ? 'on' : 'off'; if (DIRECTORY_SEPARATOR !== '/') { static::safeEcho("---------------------------------------------- WORKERMAN -----------------------------------------------\r\n"); - static::safeEcho('Workerman version:'. static::VERSION. ' PHP version:'. \PHP_VERSION. "\r\n"); + static::safeEcho('Workerman version:'. static::VERSION. ' PHP version:'. \PHP_VERSION . " (Jit $jitStatus)\r\n"); static::safeEcho("----------------------------------------------- WORKERS ------------------------------------------------\r\n"); static::safeEcho("worker listen processes status\r\n"); return; } //show version - $lineVersion = 'Workerman version:' . static::VERSION . str_pad('PHP version:', 16, ' ', STR_PAD_LEFT) . PHP_VERSION . str_pad('Event-loop:', 16, ' ', STR_PAD_LEFT) . static::getEventLoopName() . PHP_EOL; + $lineVersion = 'Workerman version:' . static::VERSION . str_pad('PHP version:', 16, ' ', STR_PAD_LEFT) . PHP_VERSION . " (Jit $jitStatus)" . str_pad('Event-loop:', 16, ' ', STR_PAD_LEFT) . static::getEventLoopName() . PHP_EOL; !defined('LINE_VERSION_LENGTH') && define('LINE_VERSION_LENGTH', strlen($lineVersion)); $totalLength = static::getSingleLineTotalLength(); $lineOne = '' . str_pad(' WORKERMAN ', $totalLength + strlen(''), '-', STR_PAD_BOTH) . '' . PHP_EOL;