amnuts / opcache-gui

A clean, effective and responsive interface for Zend OPcache
1.21k stars 197 forks source link

JIT buffer tab shows even if JIT is disabled #105

Closed krzotr closed 8 months ago

krzotr commented 8 months ago

JIT has been introduced in PHP 8.0. There is no information in opcache-gui if JIT is enabled or disabled. Even if JIT is disabled on the right side I see jit buffer (Tested on 8.2.11)

Fix: Condition should be !empty($status['jit']['enabled'])

https://github.com/amnuts/opcache-gui/blob/edbcbbedd007dfd8b2bbf1f4f362ea4892738c41/index.php#L420

Is any way to add additional information for PHP >= 8.0 if JIT is Enabled/Disabled in General info tab?

amnuts commented 8 months ago

Hey @krzotr,

Could you define a little more about there being "no information" on whether it's enabled or not.

When I have it enabled with the tracing or function value for opcache.jit, it shows such as:

Screenshot 2023-10-21 195249

When I have it disabled with disable or off for opcache.jit it shows such as:

Screenshot 2023-10-21 195509

If you want to turn off the graph, that's a separate value, part of the highlight config setting you pass in to Service::__construct().

krzotr commented 8 months ago

Hi @amnuts ,

From documentation: opcache.jit_buffer_size - The amount of shared memory to reserve for compiled JIT code. A zero value disables the JIT.

I enabled JIT by opcache.jit_buffer_size = 48M in php.ini (all opcache.* setting by default)

jit

I was wondering why all the time jit buffer / free is empty. I checked error log. I had Xdebug enabled.

[21-Oct-2023 22:06:58] NOTICE: PHP message: PHP Warning:  JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled. in Unknown on line 0

There is no information in opcache-gui if JIT is enabled/disabled. If JIT is disabled jit buffer information in the right menu is useless (all zeros). Directive opcache.jit does mean JIT is enabled

Example:

var_dump(
    opcache_get_configuration()['directives']['opcache.jit'],
    opcache_get_status()['jit']['enabled']
);

To get information if JIT is really enabled / disabled we have to use opcache_get_status()['jit']['enabled']

If JIT is enabled (jit buffer 48MB / buffer free 47.99MB) everything looks fine

jit2

amnuts commented 8 months ago

Thanks for that explanation, @krzotr, I get what you're saying now.

I've been looking at it from the opcache.jit setting, and having that off or not, but that's not taking into account if opcache is being disabled by other means, like xdebug or not setting the memory limit. 👍

OK, I'll have a look into that. And it probably makes sense not to show the jit stuff if it's disabled, irrespective of the highlight setting, so I'll look into that, too.

amnuts commented 8 months ago

@krzotr, this is now fixed and released.

Will now hide the JIT stats if it's disabled, and also show clearly if it's disabled or not:

image

image

image

image