Skip to content

Commit 840c0d6

Browse files
committed
Add stats to phpinfo
1 parent 5b0879e commit 840c0d6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ext/opcache/zend_accelerator_module.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,33 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
356356
if (!accel_startup_ok || zps_api_failure_reason) {
357357
php_info_print_table_row(2, "Startup Failed", zps_api_failure_reason);
358358
} else {
359+
char buf[32];
359360
php_info_print_table_row(2, "Startup", "OK");
360361
php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
362+
snprintf(buf, sizeof(buf), "%ld", ZCSG(hits));
363+
php_info_print_table_row(2, "Cache hits", buf);
364+
snprintf(buf, sizeof(buf), "%ld", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
365+
php_info_print_table_row(2, "Cache misses", buf);
366+
snprintf(buf, sizeof(buf), "%ld", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
367+
php_info_print_table_row(2, "Used memory", buf);
368+
snprintf(buf, sizeof(buf), "%ld", zend_shared_alloc_get_free_memory());
369+
php_info_print_table_row(2, "Free memory", buf);
370+
snprintf(buf, sizeof(buf), "%ld", ZSMMG(wasted_shared_memory));
371+
php_info_print_table_row(2, "Wasted memory", buf);
372+
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_direct_entries);
373+
php_info_print_table_row(2, "Cached scripts", buf);
374+
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_entries);
375+
php_info_print_table_row(2, "Cached keys", buf);
376+
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).max_num_entries);
377+
php_info_print_table_row(2, "Max keys", buf);
378+
snprintf(buf, sizeof(buf), "%ld", ZCSG(oom_restarts));
379+
php_info_print_table_row(2, "OOM restarts", buf);
380+
snprintf(buf, sizeof(buf), "%ld", ZCSG(wasted_restarts));
381+
php_info_print_table_row(2, "Wasted memory restarts", buf);
382+
snprintf(buf, sizeof(buf), "%ld", ZCSG(hash_restarts));
383+
php_info_print_table_row(2, "Hash keys restarts", buf);
384+
snprintf(buf, sizeof(buf), "%ld", ZCSG(manual_restarts));
385+
php_info_print_table_row(2, "Manual restarts", buf);
361386
}
362387
}
363388

0 commit comments

Comments
 (0)