Browse Source

change misses to updates. misses is kept for compatibility reason but deprecated

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@936 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
0731922a6e
  1. 4
      admin/common-zh-simplified-utf-8.lang.php
  2. 4
      admin/common-zh-traditional-utf-8.lang.php
  3. 2
      admin/help-en.lang.php
  4. 2
      admin/help-zh-simplified-utf-8.lang.php
  5. 2
      admin/help-zh-traditional-utf-8.lang.php
  6. 6
      admin/xcache.tpl.php
  7. 64
      xcache.c
  8. 2
      xcache.h

4
admin/common-zh-simplified-utf-8.lang.php

@ -35,8 +35,8 @@ $strings = array(
=> '命中/H',
'Hits/S'
=> '命中/S',
'Misses'
=> '错过',
'Updates'
=> '更新',
'Clogs'
=> '阻塞',
'OOMs'

4
admin/common-zh-traditional-utf-8.lang.php

@ -35,8 +35,8 @@ $strings = array(
=> '命中/H',
'Hits/S'
=> '命中/S',
'Misses'
=> '錯過',
'Updates'
=> '更新',
'Clogs'
=> '阻塞',
'OOMs'

2
admin/help-en.lang.php

@ -10,7 +10,7 @@
<dt><?php echo _T('Hits/H'); ?>: </dt><dd>Average Hits per Hour. Only last 24 hours is logged</dd>
<dt><?php echo _T('Hits 24H'); ?>: </dt><dd>Hits 24 Hours. Hits graph of last 24 hours</dd>
<dt><?php echo _T('Hits/S'); ?>: </dt><dd>Average Hits per Second. Only last 5 seconds is logged</dd>
<dt><?php echo _T('Misses'); ?>: </dt><dd>Cache Misses, miss=a var/php is requested but not in the cache</dd>
<dt><?php echo _T('Updates'); ?>: </dt><dd>Cache Updates, miss=a var/php is requested but not in the cache</dd>
<dt><?php echo _T('Clogs'); ?>: </dt><dd>Compiling Clogs, clog=compiling is needed but avoided to wait(be blocked) when the cache is busy compiling already</dd>
<dt><?php echo _T('OOMs'); ?>: </dt><dd>Out Of Memory, how many times a new item should be stored but there isn't enough memory in the cache, think of increasing the xcache.size or xcache.var_size</dd>
<dt><?php echo _T('Errors'); ?>: </dt><dd>Compiler errors, how many times your script is compiled but failed. You should really check what is happening if you see this value increase. See <a href="http://www.php.net/manual/en/ref.errorfunc.php#ini.error-log">ini.error-log</a> and <a href="http://cn2.php.net/manual/en/ref.errorfunc.php#ini.display-errors">ini.display-errors</a></dd>

2
admin/help-zh-simplified-utf-8.lang.php

@ -10,7 +10,7 @@
<dt><?php echo _T('Hits/H'); ?>: </dt><dd>每小时命中次数. 只统计最后 24 小时</dd>
<dt><?php echo _T('Hits 24H'); ?>: </dt><dd>24 小时命中分布图. 图表现是最后 24 小时的命中次数</dd>
<dt><?php echo _T('Hits/S'); ?>: </dt><dd>每秒命中次数. 只统计最后 5 秒</dd>
<dt><?php echo _T('Misses'); ?>: </dt><dd>共享内存错过次数, 错过=请求的php或者变量并不在该共享内存内</dd>
<dt><?php echo _T('Updates'); ?>: </dt><dd>共享内存更新次数</dd>
<dt><?php echo _T('Clogs'); ?>: </dt><dd>编译阻塞跳过, 阻塞=当需该共享内存区负责编译时, 其他进程/现成无法访问此共享内存. 跳过=XCache 自动判断阻塞的共享内存区自动跳过阻塞等待, 直接使用非共享内存方式继续处理请求</dd>
<dt><?php echo _T('OOMs'); ?>: </dt><dd>内存不足次数, 显示需要存储新数据但是共享内存区内存不足的次数. 如果出现太频繁请考虑加大配置中的 xcache.size 或者 xcache.var_size</dd>
<dt><?php echo _T('Errors'); ?>: </dt><dd>编译错误, 显示您的脚本被编译时出错的次数. 如果您发现这个数字不断增长, 您应该检查什么脚本产生错误. 参考 <a href="http://www.php.net/manual/en/ref.errorfunc.php#ini.error-log">ini.error-log</a> and <a href="http://cn2.php.net/manual/en/ref.errorfunc.php#ini.display-errors">ini.display-errors</a></dd>

2
admin/help-zh-traditional-utf-8.lang.php

@ -7,7 +7,7 @@
<dt><?php echo _T('Clear'); ?>: </dt><dd>清除按鈕,點擊按鈕清除對應共享記憶體區的資料</dd>
<dt><?php echo _T('Compiling'); ?>: </dt><dd>編譯標記,當共享記憶體區正在編譯 php 指令時標記為 "yes"</dd>
<dt><?php echo _T('Hits'); ?>: </dt><dd>共享記憶體命中次數,命中=從該共享記憶體載入php或者變數</dd>
<dt><?php echo _T('Misses'); ?>: </dt><dd>共享記憶體錯過次數,錯過=請求的php或者變數並不在該共享記憶體內</dd>
<dt><?php echo _T('Updates'); ?>: </dt><dd>共享記憶更新過次數</dd>
<dt><?php echo _T('Clogs'); ?>: </dt><dd>編譯阻塞跳過,阻塞=當需該共享記憶體區負責編譯時,其他程序/現成無法存取此共享記憶體. 跳過=XCache 自動判斷阻塞的共享記憶體區自動跳過阻塞等待,直接使用非共享記憶體方式繼續處理請求</dd>
<dt><?php echo _T('OOMs'); ?>: </dt><dd>記憶體不足次數,顯示需要儲存新資料但是共享記憶體區記憶體不足的次數. 如果出現太頻繁請考慮加大配置中的 xcache.size 或者 xcache.var_size</dd>
<dt><?php echo _T('Errors'); ?>: </dt><dd>编译错误, 显示您的脚本被编译时出错的次数. 如果您发现这个数字不断增长, 您应该检查什么脚本产生错误. 参考 <a href="http://www.php.net/manual/en/ref.errorfunc.php#ini.error-log">ini.error-log</a> and <a href="http://cn2.php.net/manual/en/ref.errorfunc.php#ini.display-errors">ini.display-errors</a></dd>

6
admin/xcache.tpl.php

@ -39,7 +39,7 @@ $b = new Cycle('class="col1"', 'class="col2"');
<th><?php echo _T('Hits/H'); ?></th>
<th><?php echo _T('Hits 24H'); ?></th>
<th><?php echo _T('Hits/S'); ?></th>
<th><?php echo _T('Misses'); ?></th>
<th><?php echo _T('Updates'); ?></th>
<th><?php echo _T('Clogs'); ?></th>
<th><?php echo _T('OOMs'); ?></th>
<th><?php echo _T('Errors'); ?></th>
@ -49,7 +49,7 @@ $b = new Cycle('class="col1"', 'class="col2"');
<th><?php echo _T('GC'); ?></th>
</tr>
<?php
$numkeys = explode(',', 'slots,size,avail,hits,misses,clogs,ooms,errors,cached,deleted');
$numkeys = explode(',', 'slots,size,avail,hits,updates,clogs,ooms,errors,cached,deleted');
$l_clear = _T('Clear');
$l_clear_confirm = _T('Sure to clear?');
foreach ($cacheinfos as $i => $ci) {
@ -116,7 +116,7 @@ $b = new Cycle('class="col1"', 'class="col2"');
<td>{$hits_avg_h}</td>
<td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td>
<td>{$hits_avg_s}</td>
<td>{$ci['misses']}</td>
<td>{$ci['updates']}</td>
<td>{$ci['clogs']}</td>
<td>{$ci['ooms']}</td>
<td>{$ci['errors']}</td>

64
xcache.c

@ -280,6 +280,7 @@ static xc_entry_t *xc_entry_store_unlocked(xc_entry_type_t type, xc_cache_t *cac
: (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) entry TSRMLS_CC);
if (stored_entry) {
xc_entry_add_unlocked(cache, entryslotid, stored_entry);
++cache->updates;
return stored_entry;
}
else {
@ -591,7 +592,8 @@ static void xc_fillinfo_unlocked(int cachetype, xc_cache_t *cache, zval *return_
add_assoc_long_ex(return_value, ZEND_STRS("slots"), cache->hentry->size);
add_assoc_long_ex(return_value, ZEND_STRS("compiling"), cache->compiling);
add_assoc_long_ex(return_value, ZEND_STRS("misses"), cache->misses);
add_assoc_long_ex(return_value, ZEND_STRS("updates"), cache->updates);
add_assoc_long_ex(return_value, ZEND_STRS("misses"), cache->updates); /* deprecated */
add_assoc_long_ex(return_value, ZEND_STRS("hits"), cache->hits);
add_assoc_long_ex(return_value, ZEND_STRS("clogs"), cache->clogs);
add_assoc_long_ex(return_value, ZEND_STRS("ooms"), cache->ooms);
@ -1600,9 +1602,8 @@ static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
#undef X_FREE
}
/* }}} */
static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
static void xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
{
zend_op_array *op_array;
zend_uint old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
zend_bool catched = 0;
@ -1613,10 +1614,8 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *
old_funcinfo_cnt = zend_hash_num_elements(CG(function_table));
old_constinfo_cnt = zend_hash_num_elements(EG(zend_constants));
compiler->new_php.op_array = NULL;
XG(initial_compile_file_called) = 0;
zend_try {
op_array = old_compile_file(h, type TSRMLS_CC);
compiler->new_php.op_array = old_compile_file(h, type TSRMLS_CC);
} zend_catch {
catched = 1;
} zend_end_try();
@ -1625,18 +1624,17 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *
goto err_bailout;
}
if (op_array == NULL) {
if (compiler->new_php.op_array == NULL) {
goto err_op_array;
}
if (!XG(initial_compile_file_called)) {
return op_array;
return;
}
/* }}} */
/* {{{ prepare */
zend_restore_compiled_filename(h->opened_path ? h->opened_path : (char *) h->filename TSRMLS_CC);
compiler->new_php.op_array = op_array;
#ifdef HAVE_XCACHE_CONSTANT
compiler->new_php.constinfo_cnt = zend_hash_num_elements(EG(zend_constants)) - old_constinfo_cnt;
@ -1818,7 +1816,7 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *
/* }}} */
#endif
return op_array;
return;
err_alloc:
xc_free_php(&compiler->new_php TSRMLS_CC);
@ -1829,8 +1827,6 @@ err_op_array:
if (catched) {
zend_bailout();
}
return op_array;
}
/* }}} */
static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_entry, xc_entry_data_php_t *stored_php, zend_file_handle *h TSRMLS_DC) /* {{{ */
@ -1911,7 +1907,6 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
}
*/
zend_op_array *op_array;
xc_entry_php_t *stored_entry;
xc_entry_data_php_t *stored_php;
zend_bool gaveup = 0;
@ -1955,7 +1950,6 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
break;
}
cache->misses ++;
TRACE("miss entry %d:%s", compiler->new_entry.file_inode, compiler->new_entry.entry.name.str.val);
if (xc_entry_data_php_init_md5(cache, compiler TSRMLS_CC) != SUCCESS) {
@ -2007,10 +2001,8 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
}
/* }}} */
op_array = NULL;
/* {{{ compile */
/* make compile inside sandbox */
xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
#ifdef HAVE_XCACHE_CONSTANT
compiler->new_php.constinfos = NULL;
@ -2022,24 +2014,21 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
#endif
memset(&compiler->new_php.op_array_info, 0, sizeof(compiler->new_php.op_array_info));
XG(initial_compile_file_called) = 0;
zend_try {
op_array = xc_compile_php(compiler, h, type TSRMLS_CC);
xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
compiler->new_php.op_array = NULL;
xc_compile_php(compiler, h, type TSRMLS_CC);
} zend_catch {
catched = 1;
} zend_end_try();
if (catched || !op_array) {
if (catched
|| !compiler->new_php.op_array /* possible ? */
|| !XG(initial_compile_file_called)) {
goto err_aftersandbox;
}
/* not cachable */
if (!compiler->new_php.op_array) {
cache->compiling = 0;
/* it's not cachable, but don't scare the users with high misses */
cache->misses --;
xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
return op_array;
}
/* }}} */
#ifdef SHOW_DPRINT
compiler->new_entry.php = &compiler->new_php;
@ -2064,21 +2053,22 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
/* }}} */
TRACE("%s", stored_entry ? "stored" : "store failed");
cache->compiling = 0;
if (catched) {
if (catched || !stored_php) {
goto err_aftersandbox;
}
cache->compiling = 0;
xc_free_php(&compiler->new_php TSRMLS_CC);
if (stored_entry) {
if (op_array) {
if (compiler->new_php.op_array) {
#ifdef ZEND_ENGINE_2
destroy_op_array(op_array TSRMLS_CC);
destroy_op_array(compiler->new_php.op_array TSRMLS_CC);
#else
destroy_op_array(op_array);
destroy_op_array(compiler->new_php.op_array);
#endif
efree(op_array);
efree(compiler->new_php.op_array);
compiler->new_php.op_array = NULL;
h = NULL;
}
xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
@ -2087,22 +2077,22 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
else {
zend_op_array *old_active_op_array = CG(active_op_array);
/* install it */
CG(active_op_array) = op_array;
CG(active_op_array) = compiler->new_php.op_array;
xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC);
CG(active_op_array) = old_active_op_array;
}
return op_array;
return compiler->new_php.op_array;
err_aftersandbox:
xc_free_php(&compiler->new_php TSRMLS_CC);
xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
cache->compiling = 0;
if (catched) {
cache->compiling = 0;
cache->errors ++;
zend_bailout();
}
return op_array;
return compiler->new_php.op_array;
}
/* }}} */
static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
@ -2838,7 +2828,6 @@ PHP_FUNCTION(xcache_get)
}
else {
RETVAL_NULL();
cache->misses ++;
}
} LEAVE_LOCK(cache);
}
@ -3024,6 +3013,7 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{
zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_entry_var->value);
Z_LVAL_P(zv) = value;
++cache->updates;
break; /* leave lock */
}

2
xcache.h

@ -260,7 +260,7 @@ typedef struct {
xc_hash_t *hcache; /* hash to cacheid */
time_t compiling;
zend_ulong misses;
zend_ulong updates;
zend_ulong hits;
zend_ulong clogs;
zend_ulong ooms;

Loading…
Cancel
Save