如何检测 PHP JIT 是否启用

2024-03-02

检测 PHP 是否使用 JIT 编译并且从运行脚本启用 JIT 的最简单方法是什么?


您可以通过调用直接查询opcache设置opcache_get_status() https://www.php.net/manual/en/function.opcache-get-status.php:

opcache_get_status()["jit"]["enabled"];

或在中执行查找php.ini:

ini_get("opcache.jit")

这是一个整数(以字符串形式返回),其中最后一位数字表示 JIT 的状态:

0 - don't JIT
1 - minimal JIT (call standard VM handlers)
2 - selective VM handler inlining
3 - optimized JIT based on static type inference of individual function
4 - optimized JIT based on static type inference and call tree
5 - optimized JIT based on static type inference and inner procedure analyses

Source: https://wiki.php.net/rfc/jit#phpini_defaults https://wiki.php.net/rfc/jit#phpini_defaults

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何检测 PHP JIT 是否启用 的相关文章

随机推荐