Changeset 1058 in svn
 Timestamp:
 20120727T08:10:24Z (5 years ago)
 Location:
 trunk/htdocs/cacher
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/htdocs/cacher/cacher.php
r1053 r1058 92 92 } 93 93 94 function hits_to_graph($hits)95 { 96 $max = 0;97 foreach ($hits as $v) {98 if ($max < $v) {99 $max = $v;100 }94 function get_cache_hits_graph($ci, $key) 95 { 96 if ($ci['cacheid'] == 1) { 97 $max = max($ci[$key]); 98 } 99 else { 100 $max = $GLOBALS['maxhits_by_hour'][$ci['type']]; 101 101 } 102 102 if (!$max) { 103 return '';103 $max = 1; 104 104 } 105 105 $t = (time() / (60 * 60)) % 24; 106 106 $html = array(); 107 foreach ($ hitsas $i => $v) {107 foreach ($ci[$key] as $i => $v) { 108 108 $html[] = bar_hits_percent($v, $v / $max, $i == $t); 109 109 } … … 185 185 $cacheinfos = array(); 186 186 $total = array(); 187 $maxhits_by_hour = array(0, 0); 187 188 for ($i = 0; $i < $pcnt; $i ++) { 188 189 $data = xcache_info(XC_TYPE_PHP, $i); … … 194 195 $data['cacheid'] = $i; 195 196 $cacheinfos[] = $data; 197 $maxhits_by_hour[XC_TYPE_PHP] = max($maxhits_by_hour[XC_TYPE_PHP], max($data['hits_by_hour'])); 196 198 if ($pcnt >= 2) { 197 199 calc_total($total, $data); … … 218 220 $data['cacheid'] = $i; 219 221 $cacheinfos[] = $data; 222 $maxhits_by_hour[XC_TYPE_VAR] = max($maxhits_by_hour[XC_TYPE_VAR], max($data['hits_by_hour'])); 220 223 if ($vcnt >= 2) { 221 224 calc_total($total, $data); 
trunk/htdocs/cacher/cacher.tpl.php
r1053 r1058 84 84 $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2); 85 85 $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2); 86 $hits_graph_h = hits_to_graph($ci['hits_by_hour']);86 $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour'); 87 87 $hits_graph_h_w = count($ci['hits_by_hour']) * 2; 88 88
Note: See TracChangeset
for help on using the changeset viewer.