Skip to content

Commit 52d691a

Browse files
authored
Adding JIT information (#75)
* http to https (#73) * Added better jit-flag output in directives * Added additional jit information * Added a highlight/graph of jit buffer usage * Added jit buffer values to the 'memory usage' info panel * Added jit 'highlight' option * Fixed #69 * Updated README
1 parent d660fbe commit 52d691a

File tree

8 files changed

+194
-44
lines changed

8 files changed

+194
-44
lines changed

README.md

+20-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ There are two ways to getting started using this gui:
1313

1414
#### Copy/clone this repo
1515

16-
The easiest way to start using the opcache-gui is to clone this repo, or simply to copy/paste/download the `index.php` file, to a location which your web server can load. Then point your browser to that location, such as `https://www.example.com/opcache/index.php`.
16+
The easiest way to start using the opcache-gui is to clone this repo, or simply copy/paste/download the `index.php` file to a location which your web server can load. Then point your browser to that location, such as `https://www.example.com/opcache/index.php`.
1717

1818
#### Install via composer
1919

2020
You can include the files with [Composer](https://getcomposer.org/) by running the command `composer require amnuts/opcache-gui`.
2121

22-
Once in your `vendor` directory, there are numerous ways in which you can use the interface. For example if you're using a framework such as Symfony or Laravel, you could load opcache-gui into a `Controller`. Your requirements of setting it up within your framework of choice will vary, so it's not really possible to detail how to do that within this readme... but I have faith in your ability to figure it out!
22+
Once in your `vendor` directory, there are numerous ways in which you can use the interface. For example, if you're using a framework such as Symfony or Laravel, you could load opcache-gui into a `Controller`. Your requirements of setting it up within your framework of choice will vary, so it's not really possible to detail how to do that within this readme... but I have faith in your ability to figure it out!
2323

2424
The namespace used for the class is `Amnuts\Opcache`, so once the dependency is in your `autoload.php` you can use the `\Amnuts\Opcache\Service` class. For example, you could do something like:
2525

@@ -79,7 +79,8 @@ $options = [
7979
'highlight' => [
8080
'memory' => true, // show the memory chart/big number
8181
'hits' => true, // show the hit rate chart/big number
82-
'keys' => true // show the keys used chart/big number
82+
'keys' => true, // show the keys used chart/big number
83+
'jit' => true // show the jit buffer chart/big number
8384
]
8485
];
8586
```
@@ -116,9 +117,9 @@ The core PHP template used in the build process, and that acts to pass various b
116117

117118
### Overview
118119

119-
The overview will show you all the core information. From here you'll be able to see what host and platform you're running on, what version of OPcache you're using, when it was last reset, the functions that are available, all the directives and all the statistics associated with the OPcache (number of hits, memory used, free and wasted memory, etc.)
120+
The overview will show you all the core information. From here you'll be able to see what host and platform you're running on, what version of OPcache you're using, when it was last reset, the functions and directives available (with links to the php.net manual), and all the statistics associated with the OPcache (number of hits, memory used, free and wasted memory, and more).
120121

121-
![Screenshot of the Overview tab](http://amnuts.com/images/opcache/screenshot/overview-v3.0.0.png)
122+
![Screenshot of the Overview tab](http://amnuts.com/images/opcache/screenshot/overview-v3.3.0.png)
122123

123124
### Cached files
124125

@@ -154,10 +155,23 @@ Resetting can be disabled with the use of the configuration options `allow_reset
154155

155156
The interface can poll every so often to get a fresh look at the opcache. You can change how often this happens with the configuration option `refresh_time`, which is in seconds.
156157

157-
When the real-time updates are active the interface will automatically update all the values as needed. Also, if you choose to invalidate any files or reset the cache it will do this without reloading the page, so the search term you've entered, or the page you've navigated to do not get reset. If the real-time update is not on then the page will reload on any invalidation usage.
158+
When the real-time updates are active, the interface will automatically update all the values as needed.
159+
160+
Also, if you choose to invalidate any files or reset the cache it will do this without reloading the page, so the search term you've entered, or the page to which you've navigated do not get reset. If the real-time update is not on then the page will reload on any invalidation usage.
158161

159162
## Releases
160163

164+
**Version 3.3.0**\
165+
Mostly added JIT information for PHP 8:
166+
* Added JIT buffer graph (optionally able to turn it off)
167+
* Added JIT information to the memory usage panel
168+
* Improved the JIT information shown in the directives
169+
* Fixed a long outstanding interface bug that allowed you to see the 'invalidate all' link even if invalidation option was `false`
170+
171+
If you want to enable JIT you have to put in a value for the [opcache.jit_buffer_size](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit-buffer-size) ini setting, else it's disabled by default.
172+
173+
If you're not using PHP 8, the interface will compensate and not show the additional JIT information.
174+
161175
**Version 3.2.1**\
162176
Minor maintenance release to:
163177
* Put back "spaceship operator" so PHP8 doesn't give deprecation warnings (must have been accidentally removed in a previous commit)

build/_frontend/interface.jsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ function OverviewCounts(props) {
264264
const graphList = [
265265
{id: 'memoryUsageCanvas', title: 'memory', show: props.highlight.memory, value: props.overview.used_memory_percentage},
266266
{id: 'hitRateCanvas', title: 'hit rate', show: props.highlight.hits, value: props.overview.hit_rate_percentage},
267-
{id: 'keyUsageCanvas', title: 'keys', show: props.highlight.keys, value: props.overview.used_key_percentage}
267+
{id: 'keyUsageCanvas', title: 'keys', show: props.highlight.keys, value: props.overview.used_key_percentage},
268+
{id: 'jitUsageCanvas', title: 'jit buffer', show: props.highlight.jit, value: props.overview.jit_buffer_used_percentage}
268269
];
269270

270271
return (
@@ -287,6 +288,9 @@ function OverviewCounts(props) {
287288
wasted={props.overview.readable.wasted_memory}
288289
preload={props.overview.readable.preload_memory || null}
289290
wastedPercent={props.overview.wasted_percentage}
291+
jitBuffer={props.overview.readable.jit_buffer_size || null}
292+
jitBufferFree={props.overview.readable.jit_buffer_free || null}
293+
jitBufferFreePercentage={props.overview.jit_buffer_used_percentage || null}
290294
/>
291295
<StatisticsPanel
292296
num_cached_scripts={props.overview.readable.num_cached_scripts}
@@ -358,7 +362,7 @@ function Directives(props) {
358362
}
359363
return (
360364
<tr key={directive.k}>
361-
<td title={'View ' + directive.k + ' manual entry'}><a href={'http://php.net/manual/en/opcache.configuration.php#ini.'
365+
<td title={'View ' + directive.k + ' manual entry'}><a href={'https://php.net/manual/en/opcache.configuration.php#ini.'
362366
+ (directive.k).replace(/_/g,'-')} target="_blank">{dShow}</a></td>
363367
<td>{vShow}</td>
364368
</tr>
@@ -380,7 +384,7 @@ function Functions(props) {
380384
<thead><tr><th>Available functions</th></tr></thead>
381385
<tbody>
382386
{props.functions.map(f =>
383-
<tr key={f}><td><a href={"http://php.net/"+f} title="View manual page" target="_blank">{f}</a></td></tr>
387+
<tr key={f}><td><a href={"https://php.net/"+f} title="View manual page" target="_blank">{f}</a></td></tr>
384388
)}
385389
</tbody>
386390
</table>
@@ -618,6 +622,8 @@ function MemoryUsagePanel(props) {
618622
<p><b>free memory:</b> {props.free}</p>
619623
{ props.preload && <p><b>preload memory:</b> {props.preload}</p> }
620624
<p><b>wasted memory:</b> {props.wasted} ({props.wastedPercent}%)</p>
625+
{ props.jitBuffer && <p><b>jit buffer:</b> {props.jitBuffer}</p> }
626+
{ props.jitBufferFree && <p><b>jit buffer free:</b> {props.jitBufferFree} ({100 - props.jitBufferFreePercentage}%)</p> }
621627
</div>
622628
</div>
623629
);
@@ -754,7 +760,7 @@ class CachedFiles extends React.Component {
754760

755761
<h3>{allFilesTotal} files cached{showingTotal !== allFilesTotal && `, ${showingTotal} showing due to filter '${this.state.searchTerm}'`}</h3>
756762

757-
{ this.state.searchTerm && showingTotal !== allFilesTotal &&
763+
{ this.props.allow.invalidate && this.state.searchTerm && showingTotal !== allFilesTotal &&
758764
<p><a href={`?invalidate_searched=${encodeURIComponent(this.state.searchTerm)}`} onClick={this.handleInvalidate}>Invalidate all matching files</a></p>
759765
}
760766

build/build.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* OPcache GUI - build script
55
*
66
* @author Andrew Collington, andy@amnuts.com
7-
* @version 3.2.1
7+
* @version 3.3.0
88
* @link https://github.com/amnuts/opcache-gui
9-
* @license MIT, http://acollington.mit-license.org/
9+
* @license MIT, https://acollington.mit-license.org/
1010
*/
1111

1212
$parentPath = dirname(__DIR__);

build/template.phps

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace Amnuts\Opcache;
88
* A simple but effective single-file GUI for the OPcache PHP extension.
99
*
1010
* @author Andrew Collington, andy@amnuts.com
11-
* @version 3.2.1
11+
* @version 3.3.0
1212
* @link https://github.com/amnuts/opcache-gui
13-
* @license MIT, http://acollington.mit-license.org/
13+
* @license MIT, https://acollington.mit-license.org/
1414
*/
1515

1616
/*
@@ -35,7 +35,8 @@ $options = [
3535
'highlight' => [
3636
'memory' => true, // show the memory chart/big number
3737
'hits' => true, // show the hit rate chart/big number
38-
'keys' => true // show the keys used chart/big number
38+
'keys' => true, // show the keys used chart/big number
39+
'jit' => true // show the jit buffer chart/big number
3940
]
4041
];
4142

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"name": "Andrew Collington",
1010
"email": "andy@amnuts.com",
11-
"homepage": "http://www.amnuts.com/",
11+
"homepage": "https://blog.amnuts.com/",
1212
"role": "Developer"
1313
},
1414
{
@@ -23,7 +23,7 @@
2323
"require": {
2424
"ext-Zend-OPcache": "*",
2525
"php": ">=7.1.0",
26-
"ext-json": "*"
26+
"ext-json": "*"
2727
},
2828
"autoload": {
2929
"psr-4" : {

0 commit comments

Comments
 (0)