Changeset 522 for trunk/admin
- Timestamp:
- 02/17/2008 04:49:46 PM (11 months ago)
- Location:
- trunk/admin
- Files:
-
- 7 modified
-
common-zh-simplified-utf-8.lang.php (modified) (1 diff)
-
common-zh-traditional-utf-8.lang.php (modified) (1 diff)
-
help-en.lang.php (modified) (1 diff)
-
help-zh-simplified-utf-8.lang.php (modified) (1 diff)
-
xcache.css (modified) (1 diff)
-
xcache.php (modified) (3 diffs)
-
xcache.tpl.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/common-zh-simplified-utf-8.lang.php
r521 r522 28 28 'Hits' 29 29 => '命中', 30 'Hits 24H' 31 => '24H 分布', 32 'Hits/H' 33 => '命中/H', 34 'Hits/S' 35 => '命中/S', 30 36 'Misses' 31 37 => '错过', -
trunk/admin/common-zh-traditional-utf-8.lang.php
r521 r522 28 28 'Hits' 29 29 => '命中', 30 'Hits 24H' 31 => '24H 分布', 32 'Hits/H' 33 => '命中/H', 34 'Hits/S' 35 => '命中/S', 30 36 'Misses' 31 37 => '錯過', -
trunk/admin/help-en.lang.php
r458 r522 8 8 <dt><?php echo _T('Compiling'); ?>: </dt><dd>Compiling flag, "yes" if the cache is busy compiling php script</dd> 9 9 <dt><?php echo _T('Hits'); ?>: </dt><dd>Cache Hits, hit=a var/php is loaded from this cache</dd> 10 <dt><?php echo _T('Hits/H'); ?>: </dt><dd>Average Hits per Hour. Only last 24 hours is logged</dd> 11 <dt><?php echo _T('Hits 24H'); ?>: </dt><dd>Hits 24 Hours. Hits graph of last 24 hours</dd> 12 <dt><?php echo _T('Hits/S'); ?>: </dt><dd>Average Hits per Second. Only last 5 seconds is logged</dd> 10 13 <dt><?php echo _T('Misses'); ?>: </dt><dd>Cache Misses, miss=a var/php is requested but not in the cache</dd> 11 14 <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> -
trunk/admin/help-zh-simplified-utf-8.lang.php
r458 r522 8 8 <dt><?php echo _T('Compiling'); ?>: </dt><dd>编译标记, 当共享内存区正在编译 php 脚本时标记为 "yes"</dd> 9 9 <dt><?php echo _T('Hits'); ?>: </dt><dd>共享内存命中次数, 命中=从该共享内存载入php或者变量</dd> 10 <dt><?php echo _T('Hits/H'); ?>: </dt><dd>每小时命中次数. 只统计最后 24 小时</dd> 11 <dt><?php echo _T('Hits 24H'); ?>: </dt><dd>24 小时命中分布图. 图表现是最后 24 小时的命中次数</dd> 12 <dt><?php echo _T('Hits/S'); ?>: </dt><dd>每秒命中次数. 只统计最后 5 秒</dd> 10 13 <dt><?php echo _T('Misses'); ?>: </dt><dd>共享内存错过次数, 错过=请求的php或者变量并不在该共享内存内</dd> 11 14 <dt><?php echo _T('Clogs'); ?>: </dt><dd>编译阻塞跳过, 阻塞=当需该共享内存区负责编译时, 其他进程/现成无法访问此共享内存. 跳过=XCache 自动判断阻塞的共享内存区自动跳过阻塞等待, 直接使用非共享内存方式继续处理请求</dd> -
trunk/admin/xcache.css
r521 r522 28 28 .freeblockgraph { border: 1px solid gray; border-bottom: 0px; } 29 29 30 .hitsgraph { height: 20px; border: solid gray; border-width: 1px 0 1px 0; margin: auto; } 31 .hitsgraph div { float: left; width: 2px; height: 100%; } 32 .bitsgraph div div { float: none; width: 100%; } 33 30 34 .switcher, h1, h2 { text-align: center; display: block; } 31 35 .switcher * { color: blue; } -
trunk/admin/xcache.php
r521 r522 110 110 $b = $c; 111 111 $html[] = '<div style="background: rgb(' . "$r,$g,$b" . ')"></div>'; 112 } 113 return implode('', $html); 114 } 115 116 function calc_total(&$total, $data) 117 { 118 foreach ($data as $k => $v) { 119 switch ($k) { 120 case 'type': 121 case 'cache_name': 122 case 'cacheid': 123 case 'free_blocks': 124 continue 2; 125 } 126 if (!isset($total[$k])) { 127 $total[$k] = $v; 128 } 129 else { 130 switch ($k) { 131 case 'his_by_hour': 132 case 'his_by_second': 133 foreach ($data[$k] as $kk => $vv) { 134 $total[$k][$kk] += $vv; 135 } 136 break; 137 138 default: 139 $total[$k] += $v; 140 } 141 } 142 } 143 } 144 145 function array_avg($a) 146 { 147 if (count($a) == 0) { 148 return ''; 149 } 150 return array_sum($a) / count($a); 151 } 152 153 function bar_percent($percent) 154 { 155 $r = 220 + (int) ($percent * 25); 156 $g = $b = 220 - (int) ($percent * 220); 157 $percent = (int) ($percent * 100); 158 return '<div>' 159 . '<div style="height: ' . (100 - $percent) . '%"></div>' 160 . '<div style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>' 161 . '</div>'; 162 } 163 164 function hits_to_graph($hits) 165 { 166 $max = 0; 167 foreach ($hits as $v) { 168 if ($max < $v) { 169 $max = $v; 170 } 171 } 172 if (!$max) { 173 return ''; 174 } 175 $html = array(); 176 foreach ($hits as $v) { 177 $html[] = bar_percent($v / $max); 112 178 } 113 179 return implode('', $html); … … 196 262 $cacheinfos[] = $data; 197 263 if ($pcnt >= 2) { 198 foreach ($data as $k => $v) { 199 switch ($k) { 200 case 'type': 201 case 'cache_name': 202 case 'cacheid': 203 case 'free_blocks': 204 continue 2; 205 } 206 if (!isset($total[$k])) { 207 $total[$k] = $v; 208 } 209 else { 210 $total[$k] += $v; 211 } 212 } 264 calc_total($total, $data); 213 265 } 214 266 } … … 234 286 $cacheinfos[] = $data; 235 287 if ($pcnt >= 2) { 236 foreach ($data as $k => $v) { 237 switch ($k) { 238 case 'type': 239 case 'cache_name': 240 case 'cacheid': 241 case 'free_blocks': 242 case 'gc': 243 continue 2; 244 } 245 if (!isset($total[$k])) { 246 $total[$k] = $v; 247 } 248 else { 249 $total[$k] += $v; 250 } 251 } 288 calc_total($total, $data); 252 289 } 253 290 } -
trunk/admin/xcache.tpl.php
r521 r522 17 17 <col align="right" /> 18 18 <col align="right" /> 19 <col /> 20 <col align="right" /> 21 <col align="right" /> 19 22 <col align="right" /> 20 23 <col align="right" /> … … 32 35 <th><?php echo _T('Compiling'); ?></th> 33 36 <th><?php echo _T('Hits'); ?></th> 37 <th><?php echo _T('Hits/H'); ?></th> 38 <th><?php echo _T('Hits 24H'); ?></th> 39 <th><?php echo _T('Hits/S'); ?></th> 34 40 <th><?php echo _T('Misses'); ?></th> 35 41 <th><?php echo _T('Clogs'); ?></th> … … 65 71 $ci_avail = size($ci['avail']); 66 72 $ci = number_formats($ci, $numkeys); 73 74 $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); 75 $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); 76 $hits_graph_h = hits_to_graph($ci['hits_by_hour']); 77 $hits_graph_h_w = count($ci['hits_by_hour']) * 2; 78 67 79 if (!empty($ci['istotal'])) { 68 80 $ci['compiling'] = '-'; … … 95 107 <td>{$ci['compiling']}</td> 96 108 <td>{$ci['hits']}</td> 109 <td>{$hits_avg_h}</td> 110 <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td> 111 <td>{$hits_avg_s}</td> 97 112 <td>{$ci['misses']}</td> 98 113 <td>{$ci['clogs']}</td>

