diff --git a/admin/apc.php b/admin/apc.php index f244d27..8650d6e 100644 --- a/admin/apc.php +++ b/admin/apc.php @@ -194,7 +194,7 @@ if(!function_exists('apcu_cache_info')) { exit; } -$cache = apcu_cache_info(); +$cache = apcu_cache_info(); $mem=apcu_sma_info(); @@ -258,13 +258,13 @@ if (isset($MYREQUEST['IMG'])) if ($text) { if ($placeindex>0) { imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); - imagestring($im,4,$diameter, $placeindex*12,$text,$color1); - + imagestring($im,4,$diameter, $placeindex*12,$text,$color1); + } else { imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); } } - } + } function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) { $r=$diameter/2; @@ -272,13 +272,13 @@ if (isset($MYREQUEST['IMG'])) if ($placeindex>0) { imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); - imagestring($im,4,$diameter, $placeindex*12,$text,$color1); - + imagestring($im,4,$diameter, $placeindex*12,$text,$color1); + } else { imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); } - } - + } + function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { global $col_black; $x1=$x+$w-1; @@ -290,15 +290,15 @@ if (isset($MYREQUEST['IMG'])) imagerectangle($im, $x, $y1, $x1, $y, $color1); if ($text) { if ($placeindex>0) { - + if ($placeindex<16) { $px=5; $py=$placeindex*12+6; imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2); imageline($im,$x,$y+$h/2,$px+90,$py,$color2); - imagestring($im,2,$px,$py-6,$text,$color1); - + imagestring($im,2,$px,$py-6,$text,$color1); + } else { if ($placeindex<31) { $px=$x+40*2; @@ -309,7 +309,7 @@ if (isset($MYREQUEST['IMG'])) } imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2); imageline($im,$x+$w,$y+$h/2,$px,$py,$color2); - imagestring($im,2,$px+2,$py-6,$text,$color1); + imagestring($im,2,$px+2,$py-6,$text,$color1); } } else { imagestring($im,4,$x+5,$y1-16,$text,$color1); @@ -331,7 +331,7 @@ if (isset($MYREQUEST['IMG'])) imagecolortransparent($image,$col_white); switch ($MYREQUEST['IMG']) { - + case 1: $s=$mem['num_seg']*$mem['seg_size']; $a=$mem['avail_mem']; @@ -342,7 +342,7 @@ if (isset($MYREQUEST['IMG'])) // would expect because we try to visualize any memory fragmentation as well. $angle_from = 0; $string_placement=array(); - for($i=0; $i<$mem['num_seg']; $i++) { + for($i=0; $i<$mem['num_seg']; $i++) { $ptr = 0; $free = $mem['block_lists'][$i]; uasort($free, 'block_sort'); @@ -369,7 +369,7 @@ if (isset($MYREQUEST['IMG'])) $angle_from = $angle_to; $ptr = $block['offset']+$block['size']; } - if ($ptr < $mem['seg_size']) { // memory at the end + if ($ptr < $mem['seg_size']) { // memory at the end $angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s; if(($angle_to+$fuzz)>1) $angle_to = 1; fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red); @@ -383,14 +383,14 @@ if (isset($MYREQUEST['IMG'])) } break; - case 2: - $s=$cache['nhits']+$cache['nmisses']; - $a=$cache['nhits']; - - fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['nhits']*100/$s : 0)); - fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['nmisses']*100/$s : 0)); + case 2: + $s=$cache['num_hits']+$cache['num_misses']; + $a=$cache['num_hits']; + + fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0)); + fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0)); break; - + case 3: $s=$mem['num_seg']*$mem['seg_size']; $a=$mem['avail_mem']; @@ -400,7 +400,7 @@ if (isset($MYREQUEST['IMG'])) // This block of code creates the bar chart. It is a lot more complex than you // would expect because we try to visualize any memory fragmentation as well. - for($i=0; $i<$mem['num_seg']; $i++) { + for($i=0; $i<$mem['num_seg']; $i++) { $ptr = 0; $free = $mem['block_lists'][$i]; uasort($free, 'block_sort'); @@ -423,7 +423,7 @@ if (isset($MYREQUEST['IMG'])) $y+=$h; $ptr = $block['offset']+$block['size']; } - if ($ptr < $mem['seg_size']) { // memory at the end + if ($ptr < $mem['seg_size']) { // memory at the end $h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s; if ($h > 0) { fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++); @@ -432,12 +432,12 @@ if (isset($MYREQUEST['IMG'])) } break; - case 4: - $s=$cache['nhits']+$cache['nmisses']; - $a=$cache['nhits']; - - fill_box($image, 30,$size,50,$s ? -$a*($size-21)/$s : 0,$col_black,$col_green,sprintf("%.1f%%", $s ? $cache['nhits']*100/$s : 0)); - fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%", $s ? $cache['nmisses']*100/$s : 0)); + case 4: + $s=$cache['num_hits']+$cache['num_misses']; + $a=$cache['num_hits']; + + fill_box($image, 30,$size,50,$s ? -$a*($size-21)/$s : 0,$col_black,$col_green,sprintf("%.1f%%", $s ? $cache['num_hits']*100/$s : 0)); + fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%", $s ? $cache['num_misses']*100/$s : 0)); break; } @@ -459,7 +459,7 @@ function bsize($s) { // sortable table header in "scripts for this host" view function sortheader($key,$name,$extra='') { global $MYREQUEST, $MY_SELF_WO_SORT; - + if ($MYREQUEST['SORT1']==$key) { $MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A'; } @@ -467,7 +467,7 @@ function sortheader($key,$name,$extra='') { } -// create menu entry +// create menu entry function menu_entry($ob,$title) { global $MYREQUEST,$MY_SELF; if ($MYREQUEST['OB']!=$ob) { @@ -475,7 +475,7 @@ function menu_entry($ob,$title) { } else if (empty($MYREQUEST['SH'])) { return "
  • $title
  • "; } else { - return "
  • $title
  • "; + return "
  • $title
  • "; } } @@ -632,8 +632,8 @@ ol.menu a:hover { background:rgb(193,193,244); text-decoration:none; } - - + + div.info { background:rgb(204,204,204); border:solid rgb(204,204,204) 1px; @@ -706,7 +706,7 @@ div.authneeded { padding:2em; text-align:center; } - + input { background:rgb(153,153,204); border:solid rgb(102,102,153) 2px; @@ -745,7 +745,7 @@ echo menu_entry(OB_HOST_STATS,'View Host Stats'), menu_entry(OB_USER_CACHE,'User Cache Entries'), menu_entry(OB_VERSION_CHECK,'Version Check'); - + if ($AUTHENTICATED) { echo <<Clear Cache @@ -761,7 +761,7 @@ echo << EOB; -// MAIN SWITCH STATEMENT +// MAIN SWITCH STATEMENT switch ($MYREQUEST['OB']) { // ----------------------------------------------- @@ -772,13 +772,13 @@ case OB_HOST_STATS: $mem_avail= $mem['avail_mem']; $mem_used = $mem_size-$mem_avail; $seg_size = bsize($mem['seg_size']); - $req_rate_user = sprintf("%.2f", $cache['nhits'] ? (($cache['nhits']+$cache['nmisses'])/($time-$cache['stime'])) : 0); - $hit_rate_user = sprintf("%.2f", $cache['nhits'] ? (($cache['nhits'])/($time-$cache['stime'])) : 0); - $miss_rate_user = sprintf("%.2f", $cache['nmisses'] ? (($cache['nmisses'])/($time-$cache['stime'])) : 0); - $insert_rate_user = sprintf("%.2f", $cache['ninserts'] ? (($cache['ninserts'])/($time-$cache['stime'])) : 0); + $req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time'])) : 0); + $hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/($time-$cache['start_time'])) : 0); + $miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/($time-$cache['start_time'])) : 0); + $insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/($time-$cache['start_time'])) : 0); $apcversion = phpversion('apcu'); $phpversion = phpversion(); - $number_vars = $cache['nentries']; + $number_vars = $cache['num_entries']; $size_vars = bsize($cache['mem_size']); $i=0; echo <<< EOB @@ -794,13 +794,12 @@ EOB; echo "Server Software{$_SERVER['SERVER_SOFTWARE']}\n"; echo <<Shared Memory{$mem['num_seg']} Segment(s) with $seg_size + Shared Memory{$mem['num_seg']} Segment(s) with $seg_size
    ({$cache['memory_type']} memory) EOB; - echo 'Start Time',date(DATE_FORMAT,$cache['stime']),''; - echo 'Uptime',duration($cache['stime']),''; - echo 'File Upload Support',$cache['file_upload_progress'],''; + echo 'Start Time',date(DATE_FORMAT,$cache['start_time']),''; + echo 'Uptime',duration($cache['start_time']),''; echo << @@ -809,13 +808,13 @@ EOB; - - + + - +
    Cached Variables$number_vars ($size_vars)
    Hits{$cache['nhits']}
    Misses{$cache['nmisses']}
    Hits{$cache['num_hits']}
    Misses{$cache['num_misses']}
    Request Rate (hits, misses)$req_rate_user cache requests/second
    Hit Rate$hit_rate_user cache requests/second
    Miss Rate$miss_rate_user cache requests/second
    Insert Rate$insert_rate_user cache requests/second
    Cache full count{$cache['nexpunges']}
    Cache full count{$cache['expunges']}
    @@ -850,18 +849,18 @@ echo <<'. "\"\"". "\"\"\n" : "", '', ' Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"\n", - ' Hits: ',$cache['nhits'].@sprintf(" (%.1f%%)",$cache['nhits']*100/($cache['nhits']+$cache['nmisses'])),"\n", + ' Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"\n", '', '', - ' Used: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"\n", - ' Misses: ',$cache['nmisses'].@sprintf(" (%.1f%%)",$cache['nmisses']*100/($cache['nhits']+$cache['nmisses'])),"\n"; + ' Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"\n", + ' Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"\n"; echo <<< EOB @@ -888,7 +887,7 @@ EOB; } $freeseg += count($mem['block_lists'][$i]); } - + if ($freeseg > 1) { $frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg); } else { @@ -918,7 +917,7 @@ EOB; EOB; - + break; @@ -932,9 +931,9 @@ case OB_USER_CACHE: echo ''; break; } - $fieldname='key'; + $fieldname='info'; $fieldheading='User Entry Label'; - $fieldkey='key'; + $fieldkey='info'; $cols=6; echo << ", @@ -956,7 +955,7 @@ EOB; ""; if($fieldname=='info') echo ""; - echo + echo '', '