Browse Source

fixed #39: ini_set never work for xcache.coverager setting

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1117 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
01b891c66a
  1. 2
      ChangeLog
  2. 17
      mod_coverager/xc_coverager.c
  3. 5
      xcache-zh-gb2312.ini
  4. 5
      xcache.ini
  5. 3
      xcache_globals.h

2
ChangeLog

@ -7,12 +7,14 @@ API Changes
Ini Settings Changes
========
* new: xcache.disable_on_crash = Off
* new: xcache.coverager_autostart = On
ChangeLog
========
* closes #2: auto disable caching on crash
* closes #73: warn for improper PHP_FCGI_CHILDREN setting fcgi mode (>=PHP_5_3)
* closes #174: updated api to support "clear all cache"
* fixed #39: ini_set never work for xcache.coverager setting. use API instead
* code refactor
* uses extension to load XCache. load via zend_extension is unsupported
* split XCache features into multiple sub modules

17
mod_coverager/xc_coverager.c

@ -244,19 +244,21 @@ static void xc_coverager_cleanup(TSRMLS_D) /* {{{ */
static void xc_coverager_enable(TSRMLS_D) /* {{{ */
{
XG(coverage_enabled) = 1;
XG(coverager_enabled) = 1;
}
/* }}} */
static void xc_coverager_disable(TSRMLS_D) /* {{{ */
{
XG(coverage_enabled) = 0;
XG(coverager_enabled) = 0;
}
/* }}} */
static PHP_RINIT_FUNCTION(xcache_coverager) /* {{{ */
{
if (XG(coverager)) {
xc_coverager_enable(TSRMLS_C);
if (XG(coverager_autostart)) {
xc_coverager_enable(TSRMLS_C);
}
#ifdef ZEND_COMPILE_EXTENDED_INFO
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
#else
@ -264,7 +266,7 @@ static PHP_RINIT_FUNCTION(xcache_coverager) /* {{{ */
#endif
}
else {
XG(coverage_enabled) = 0;
XG(coverager_enabled) = 0;
}
return SUCCESS;
}
@ -468,7 +470,7 @@ static void xc_coverager_handle_ext_stmt(zend_op_array *op_array, zend_uchar op)
{
TSRMLS_FETCH();
if (XG(coverages) && XG(coverage_enabled)) {
if (XG(coverages) && XG(coverager_enabled)) {
int size = xc_coverager_get_op_array_size_no_tail(op_array);
int oplineno = (*EG(opline_ptr)) - op_array->opcodes;
if (oplineno < size) {
@ -630,7 +632,8 @@ static zend_extension xc_coverager_zend_extension_entry = {
/* }}} */
/* {{{ PHP_INI */
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("xcache.coverager" , "0", PHP_INI_ALL, OnUpdateBool, coverager, zend_xcache_globals, xcache_globals)
STD_PHP_INI_BOOLEAN("xcache.coverager", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, coverager, zend_xcache_globals, xcache_globals)
STD_PHP_INI_BOOLEAN("xcache.coverager_autostart", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, coverager_autostart, zend_xcache_globals, xcache_globals)
PHP_INI_ENTRY1 ("xcache.coveragedump_directory", "", PHP_INI_SYSTEM, xcache_OnUpdateDummy, NULL)
PHP_INI_END()
/* }}} */
@ -643,7 +646,7 @@ static PHP_MINFO_FUNCTION(xcache_coverager) /* {{{ */
if (cfg_get_string("xcache.coveragedump_directory", &covdumpdir) != SUCCESS || !covdumpdir[0]) {
covdumpdir = NULL;
}
php_info_print_table_row(2, "Coverage Auto Dumper", XG(coverager) && covdumpdir ? "enabled" : "disabled");
php_info_print_table_row(2, "Coverage Started", XG(coverager_started) && covdumpdir ? "On" : "Off");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();

5
xcache-zh-gb2312.ini

@ -64,11 +64,12 @@ xcache.optimizer = Off
[xcache.coverager]
; 本功能开启后降低运行性能
; 在 xcache.coverager == On && xcache.coveragedump_directory == "非空值" 时本功能才会启用
; 在 xcache.coverager == On && xcache.coveragedump_directory == "非空值" 时本功能才会启用
; per request settings. 可以 ini_set, .htaccess 等
; 启用代码流程覆盖面信息采集以及 xcache_coverager_start/stop/get/clean() 等函数
xcache.coverager = Off
xcache.coverager = Off
xcache.coverager_autostart = On
; 仅在 php ini 文件内设置
; 请确保本目录能被 coverage viewer 脚本读取 (注意 open_basedir)

5
xcache.ini

@ -64,11 +64,12 @@ xcache.optimizer = Off
[xcache.coverager]
; enabling this feature will impact performance
; enable only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value"
; enabled only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value"
; per request settings. can ini_set, .htaccess etc
; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions
xcache.coverager = Off
xcache.coverager = Off
xcache.coverager_autostart = On
; set in php ini file only
; make sure it's readable (open_basedir is checked) by coverage viewer script

3
xcache_globals.h

@ -10,7 +10,8 @@ ZEND_BEGIN_MODULE_GLOBALS(xcache)
#endif
#ifdef HAVE_XCACHE_COVERAGER
zend_bool coverager;
zend_bool coverage_enabled;
zend_bool coverager_autostart;
zend_bool coverager_enabled;
HashTable *coverages; /* coverages[file][line] = times */
#endif
xc_stack_t *php_holds;

Loading…
Cancel
Save