amnuts / opcache-gui

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

JIT stats #74

Closed javiergutierrezchamorro closed 3 years ago

javiergutierrezchamorro commented 3 years ago

Due to JIT opcache options available in PHP 7.4, adding JIT stats such as opcache_get_status()['jit'] would be very nice.

MichaIng commented 3 years ago

You mean available since PHP 8.0 🙂, but yes I agree that JIT stats would be great. I didn't even know that there is a related new opcache_get_status key, just tested it and it works fine, showing used and free buffer size (among others), like it is the case for overall OPcache memory and interned strings buffer.

javiergutierrezchamorro commented 3 years ago

You mean available since PHP 8.0 🙂, but yes I agree that JIT stats would be great. I didn't even know that there is a related new opcache_get_status key, just tested it and it works fine, showing used and free buffer size (among others), like it is the case for overall OPcache memory and interned strings buffer.

Indeed. Since 7.4 is the preload which is already supported byt opcache-gui. Thanks for the clarification.

amnuts commented 3 years ago

Thanks for the suggestion @javiergutierrezchamorro and @MichaIng - I can certainly make that happen at some point!

Just had a look at the jit key myself, and yes, it looks like maybe out can come another graph for the jit buffer usage (assuming it's enabled) and an info panel. I need to look up what the level and flag values represent first, and I'm a little busy this week. But I'll look to add this soon.

javiergutierrezchamorro commented 3 years ago

Thanks for the suggestion @javiergutierrezchamorro and @MichaIng - I can certainly make that happen at some point!

Just had a look at the jit key myself, and yes, it looks like maybe out can come another graph for the jit buffer usage (assuming it's enabled) and an info panel. I need to look up what the level and flag values represent first, and I'm a little busy this week. But I'll look to add this soon.

Highly appreciated. Thank you.

amnuts commented 3 years ago

@javiergutierrezchamorro and @MichaIng, I have some updates for the JIT info in the wip branch if you want to try it out?

Changes include better output of the JIT info in the directives (especially if you have the opcache.jit specified as a 4-digit number as specified in https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit), a new graph showing used JIT buffer, and also JIT buffer sizes added to the 'memory usage' info panel.

Seems OK to me so I'll probably merge into master sometime on the weekend, but please feel free to poke at it before I do.

javiergutierrezchamorro commented 3 years ago

Thank you so much @amnuts Looking so good here. 3 3 0

MichaIng commented 3 years ago

Yes, just tested it successfully as well, many thanks! Looking at the code, I'd add another $status['jit']['enabled'] to line 372 so that it is:

 if ($overview && !empty($status['jit'] && $status['jit']['enabled'])) {

to not try reading non-present keys when JIT is available (PHP8.0+) but not enabled, which is the default currently.

Also I'm not sure currently if the additional graph and section is present even if no JIT is available?

Otherwise great work 👍.

amnuts commented 3 years ago

That's interesting @MichaIng, because by default is was disabled for me (until I added some buffer value) but even still is provided all of the jit directives and values. I'll have another play just to make sure on that, though. But because they were present for me (even if the enabled state was false) I have it that the graph and additional information will show unless you specifically turn off the highlight jit graph (which will still show the info in the memory panel), or you have PHP < 8 in which case it wont include either values.

If it turns out that it causes problems when not enabled then I'll add that additional check as you suggested.

amnuts commented 3 years ago

On a completely different note; @MichaIng, you're the maintainer of DietPi?? I used that distro for the first time a number of months back to set up an HTPC on a rpi - it was an awesome experience! So lightweight, so easy to configure and setup... Really, really nice job!

MichaIng commented 3 years ago

Ah yes, "not enabled, which is the default" meant that "not enabled" is the default, a bit misleading wording.

I just found the highlight options, yes that should be okay to not make things too complicated.

And you are right, when OPcache is disabled (buffer size set to "0", default), the array keys exist and have a value of zero, so then all is fine. I remember it somehow different, but probably the code changed or I remember it simply wrong.

Then it's ready to go like it is from my end 🙂.


Yes, I'm the lead developer of DietPi. Many thanks for your kind feedback ❤️. DietPi installs your OPcache GUI by default with PHP (when done through our script), simply too useful, hence I can only give back the compliment for a nice job 👍🙂.

javiergutierrezchamorro commented 3 years ago

I guess it was documented somewhere. In order for JIT to work it should be enabled and also have a buffer_size greater than 0.

amnuts commented 3 years ago

@javiergutierrezchamorro in so much that it's documented here: https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit-buffer-size

amnuts commented 3 years ago

I added a little sentence in the README about needing to give a buffer size to enable JIT.

I've now merged into master - many thanks for your feedback @javiergutierrezchamorro and @MichaIng, it's much appreciated!


Also, had no idea DietPi included the gui with it's setup! ❤️ That's totally made my day - thanks!! 😄

javiergutierrezchamorro commented 3 years ago

Thank to you for your prompt support and reaction @amnuts amnuts