当前位置: 首页>>代码示例>>PHP>>正文


PHP bsize函数代码示例

本文整理汇总了PHP中bsize函数的典型用法代码示例。如果您正苦于以下问题:PHP bsize函数的具体用法?PHP bsize怎么用?PHP bsize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bsize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFragments

function getFragments($mem)
{
    $frags = array();
    foreach ($mem['block_lists'][0] as $block) {
        $frags[$block['offset']] = $block['size'];
    }
    ksort($frags);
    $text = array();
    $prev_val = 0;
    $i = 0;
    foreach ($frags as $key => $value) {
        $i++;
        $key = $key - $prev_val;
        $text[] = "{name: 'Used-" . bsize($key) . "',data: [" . $key . "]}";
        $text[] = "{name: 'Free-" . bsize($value) . "',data: [" . $value . "]}";
        $prev_val = $key + $prev_val + $value;
    }
    return implode(',', array_reverse($text));
}
开发者ID:siburny,项目名称:stats,代码行数:19,代码来源:fragmentation.php

示例2: htmlentities

        if (!isset($_GET['key']) || !isset($_GET['server'])) {
            echo "No key set!";
            break;
        }
        // I'm not doing anything to check the validity of the key string.
        // probably an exploit can be written to delete all the files in key=base64_encode("\n\r delete all").
        // somebody has to do a fix to this.
        $theKey = htmlentities(base64_decode($_GET['key']));
        $theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
        list($h, $p) = explode(':', $theserver);
        $r = sendMemcacheCommand($h, $p, 'get ' . $theKey);
        echo <<<EOB
        <div class="info"><table cellspacing=0><tbody>
\t\t\t<tr><th>Server<th>Key</th><th>Value</th><th>Delete</th></tr>
EOB;
        echo "<tr><td class=td-0>", $theserver, "</td><td class=td-0>", $theKey, " <br/>flag:", $r['VALUE'][$theKey]['stat']['flag'], " <br/>Size:", bsize($r['VALUE'][$theKey]['stat']['size']), "</td><td>", chunk_split($r['VALUE'][$theKey]['value'], 40), "</td>", '<td><a href="', $PHP_SELF, '&op=5&server=', (int) $_GET['server'], '&key=', base64_encode($theKey), "\">Delete</a></td>", "</tr>";
        echo <<<EOB
\t\t\t</tbody></table>
\t\t\t</div><hr/>
EOB;
        break;
    case 5:
        // item delete
        if (!isset($_GET['key']) || !isset($_GET['server'])) {
            echo "No key set!";
            break;
        }
        $theKey = htmlentities(base64_decode($_GET['key']));
        $theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
        list($h, $p) = explode(':', $theserver);
        $r = sendMemcacheCommand($h, $p, 'delete ' . $theKey);
开发者ID:hartum,项目名称:basezf,代码行数:31,代码来源:memcache.php

示例3: foreach

            $ptr = 0;
            foreach ($mem['block_lists'][$i] as $block) {
                if ($block['offset'] != $ptr) {
                    ++$nseg;
                }
                $ptr = $block['offset'] + $block['size'];
                /* Only consider blocks <5M for the fragmentation % */
                if ($block['size'] < 5 * 1024 * 1024) {
                    $fragsize += $block['size'];
                }
                $freetotal += $block['size'];
            }
            $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 {
            $frag = "0%";
        }
        if (graphics_avail()) {
            $size = 'width=' . (2 * GRAPH_SIZE + 150) . ' height=' . (GRAPH_SIZE + 10);
            echo <<<EOB
\t\t\t<img alt="" {$size} src="{$PHP_SELF}?IMG=3&{$time}">
EOB;
        }
        echo <<<EOB
\t\t</br>Fragmentation: {$frag}
\t\t</td>
\t\t</tr>
EOB;
        if (isset($mem['adist'])) {
开发者ID:mnpollotta,项目名称:webinar-framework,代码行数:31,代码来源:apc.php

示例4: block_sort

            }
        }
    }
}
function block_sort($array1, $array2)
{
    if ($array1['offset'] > $array2['offset']) {
        return 1;
    } else {
        return -1;
    }
}
$mem_size = $mem['num_seg'] * $mem['seg_size'];
$mem_avail = $mem['avail_mem'];
$mem_used = $mem_size - $mem_avail;
$seg_size = bsize($mem['seg_size']);
$req_rate = sprintf("%.2f", ($cache['num_hits'] + $cache['num_misses']) / ($time - $cache['start_time']));
$hit_rate = sprintf("%.2f", $cache['num_hits'] / ($time - $cache['start_time']));
$miss_rate = sprintf("%.2f", $cache['num_misses'] / ($time - $cache['start_time']));
$insert_rate = sprintf("%.2f", $cache['num_inserts'] / ($time - $cache['start_time']));
$req_rate_user = sprintf("%.2f", ($cache_user['num_hits'] + $cache_user['num_misses']) / ($time - $cache_user['start_time']));
$hit_rate_user = sprintf("%.2f", $cache_user['num_hits'] / ($time - $cache_user['start_time']));
$miss_rate_user = sprintf("%.2f", $cache_user['num_misses'] / ($time - $cache_user['start_time']));
$insert_rate_user = sprintf("%.2f", $cache_user['num_inserts'] / ($time - $cache_user['start_time']));
$apcversion = phpversion('apc');
$phpversion = phpversion();
$number_files = $cache['num_entries'];
$size_files = bsize($cache['mem_size']);
$number_vars = $cache_user['num_entries'];
$size_vars = bsize($cache_user['mem_size']);
开发者ID:siburny,项目名称:stats,代码行数:30,代码来源:init.php

示例5: htmlentities

        if (!isset($_GET['key']) || !isset($_GET['server'])) {
            echo "No key set!";
            break;
        }
        // I'm not doing anything to check the validity of the key string.
        // probably an exploit can be written to delete all the files in key=base64_encode("\n\r delete all").
        // somebody has to do a fix to this.
        $theKey = htmlentities(base64_decode($_GET['key']));
        $theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
        list($h, $p) = explode(':', $theserver);
        $r = sendMemcacheCommand($h, $p, 'get ' . $theKey);
        echo <<<EOB
        <div class="info"><table cellspacing="0"><tbody>
\t\t\t<tr><th>Server<th>Key</th><th>Value</th><th>Delete</th></tr>
EOB;
        echo "<tr><td class='td-0'>", $theserver, "</td><td class='td-0'>", $theKey, " <br/>flag:", $r['VALUE'][$theKey]['stat']['flag'], " <br/>Size:", bsize($r['VALUE'][$theKey]['stat']['size']), "</td><td>", chunk_split($r['VALUE'][$theKey]['value'], 40), "</td>", '<td><a href="', $INSTALLER09['baseurl'], '/staffpanel.php?tool=memcache&op=5&server=', (int) $_GET['server'], '&key=', base64_encode($theKey), "\">Delete</a></td>", "</tr>";
        echo <<<EOB
\t\t\t</tbody></table>
\t\t\t</div><hr/>
EOB;
        break;
    case 5:
        // item delete
        if (!isset($_GET['key']) || !isset($_GET['server'])) {
            echo "No key set!";
            break;
        }
        $theKey = htmlentities(base64_decode($_GET['key']));
        $theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
        list($h, $p) = explode(':', $theserver);
        $r = sendMemcacheCommand($h, $p, 'delete ' . $theKey);
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:31,代码来源:memcache.php

示例6: controller_apc

 function controller_apc(&$args, $output = "inline")
 {
     $user = User::Singleton();
     if (!($user->isLoggedIn() && $user->HasRole("ADMIN"))) {
         return;
     }
     $vars["args"] = $args;
     if (!empty($args["flush"])) {
         apc_clear_cache();
         $vars["message"] = "APC cache cleared";
     }
     $vars["apc"]["smainfo"] = apc_sma_info();
     $vars["apc"]["cacheinfo"] = apc_cache_info();
     $vars["time"] = time();
     $nseg = $freeseg = $fragsize = $freetotal = 0;
     for ($i = 0; $i < $vars["apc"]["smainfo"]['num_seg']; $i++) {
         $ptr = 0;
         foreach ($vars["apc"]["smainfo"]['block_lists'][$i] as $block) {
             if ($block['offset'] != $ptr) {
                 ++$nseg;
             }
             $ptr = $block['offset'] + $block['size'];
             /* Only consider blocks <5M for the fragmentation % */
             if ($block['size'] < 5 * 1024 * 1024) {
                 $fragsize += $block['size'];
             }
             $freetotal += $block['size'];
         }
         $freeseg += count($vars["apc"]["smainfo"]['block_lists'][$i]);
     }
     if ($freeseg > 1) {
         $vars["frag"] = sprintf("%.2f%% (%s out of %s in %d fragments)", $fragsize / $freetotal * 100, bsize($fragsize), bsize($freetotal), $freeseg);
     } else {
         $vars["frag"] = "0%";
     }
     if ($output == "ajax") {
         $vars = array("tf_debug_tab_apc" => $this->GetTemplate("./apc.tpl", $vars));
     }
     return $this->GetComponentResponse("./apc.tpl", $vars);
 }
开发者ID:ameyer430,项目名称:elation,代码行数:40,代码来源:elation.php

示例7: bsize

                </div>
            </div>
            <div class="span4">
                <div class="well well-small">
                    <h4><?php 
echo bsize(disk_free_space($file_info->getPath()));
?>
</h4>

                    <p>Cache directory free size</p>
                </div>
            </div>
            <div class="span4">
                <div class="well well-small">
                    <h4><?php 
echo bsize(disk_total_space($file_info->getPath()));
?>
</h4>

                    <p>Cache directory total size</p>
                </div>
            </div>
        </div>

    </section>

    <section>
        <a class="anchor" id="speed"></a>

        <h3>Tune Cache</h3>
开发者ID:gjerokrsteski,项目名称:php-dba-cache,代码行数:30,代码来源:index.php

示例8: fill_box

                    fill_box($image, $y, $x, $h, 50, $col_black, $col_red);
                }
                $y += $h;
            }
            $h = ($size - 5) * $block['size'] / $s;
            if ($h > 0) {
                fill_box($image, $y, $x, $h, 50, $col_black, $col_green);
            }
            $y += $h;
            $ptr = $block['offset'] + $block['size'];
        }
        if ($ptr < $mem['seg_size']) {
            // memory at the end
            $h = ($size - 5) * ($mem['seg_size'] - $ptr) / $s;
            if ($h > 0) {
                fill_box($image, $y, $x, $h, 50, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
            }
        }
    }
    header("Content-type: image/png");
    imagepng($image);
    exit;
}
function graphics_avail()
{
    return extension_loaded('gd');
}
// pretty printer for byte values
//
function bsize($s)
{
开发者ID:asemen,项目名称:Froxlor,代码行数:31,代码来源:admin_apcuinfo.php

示例9: foreach

            <th class="vtip" title="Seconds since the last access for the most recent item evicted from this class.<br>Use this to judge how recently active your evicted data is">Evicted time</th>
            <th class="vtip" title="Age of the oldest item in the LRU.">Age</th>
            <th class="vtip" title="Details and keys">Link</th>
            </tr>
            </thead>
            <tbody>

EOB;
            foreach ($entries as $slabId => $slab) {
                $itemsCount = $slab['number'];
                $chunkSize = $slabInfo[$server][$slabId]['chunk_size'];
                $itemsSpace = round($itemsCount * $chunkSize * 100 / $memcacheStats['limit_maxbytes'], 3);
                $chunks_total = $slabInfo[$server][$slabId]['total_chunks'];
                $chunks_used = $slabInfo[$server][$slabId]['used_chunks'];
                $percentFree = round(($chunks_total - $chunks_used) * 100 / $chunks_total, 2);
                $totalBytes = $chunks_total * $chunkSize;
                $usedBytes = $slabInfo[$server][$slabId]['used_chunks'] * $chunkSize;
                $unusedBytes = $totalBytes - $usedBytes;
                $dumpUrl = $PHP_SELF . '&op=2&server=' . array_search($server, $MEMCACHE_SERVERS) . '&dumpslab=' . $slabId;
                echo "\n\t\t\t\t\t<tr class=tr-{$m}>\n\t\t\t\t\t<td class=td-0>" . $slabId . "</td>\n\t\t\t\t\t<td>" . $itemsCount . "</td>\n\t\t\t\t\t<td>" . $chunkSize . "</td>\n\t\t\t\t\t<td>" . $slabInfo[$server][$slabId]['chunks_per_page'] . "</td>\n\t\t\t\t\t<td>" . $slabInfo[$server][$slabId]['total_pages'] . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($totalBytes) . "'>" . $chunks_total . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($usedBytes) . "'>" . $chunks_used . "</td>\n\t\t\t\t\t<td class='vtip' title='" . $percentFree . " % allocated chunks in this class'>" . ($chunks_total - $chunks_used) . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($unusedBytes) . "'>" . $unusedBytes . "</td>\n\t\t\t\t\t<td>" . $itemsSpace . "</td>\n\t\t\t\t\t<td>" . (int) $slab['evicted'] . "</td>\n\t\t\t\t\t<td>" . (int) $slab['evicted_time'] . "</td>\n                    <td>" . duration($time - $slab['age']) . "</td>\n\t\t\t\t\t<td class=td-0><center><a href=\"" . $dumpUrl . "\">details</a></center></td>\n\n                    </tr>";
                $m = 1 - $m;
            }
            echo <<<EOB
\t\t\t</tbody></table>
\t\t\t<hr/>
EOB;
        }
        break;
        break;
}
echo getFooter();
开发者ID:Shopatron,项目名称:mcrouter-util,代码行数:31,代码来源:memcache.php

示例10: htmlentities

\t\t\t</tbody></table>
\t\t\t</div><hr/>
EOB;
        }
        break;
        break;
    case 4:
        //item dump
        if (!isset($_GET['key']) || !isset($_GET['server'])) {
            echo "No key set!";
            break;
        }
        // I'm not doing anything to check the validity of the key string.
        // probably an exploit can be written to delete all the files in key=base64_encode("\n\r delete all").
        // somebody has to do a fix to this.
        $theKey = htmlentities(base64_decode($_GET['key']));
        $theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
        list($h, $p) = explode(':', $theserver);
        $r = sendMemcacheCommand($h, $p, 'get ' . $theKey);
        echo <<<EOB
        <div class="info"><table cellspacing=0><tbody>
\t\t\t<tr><th>Server<th>Key</th><th>Value</th></tr>
EOB;
        echo "<tr><td class=td-0>", $theserver, "</td><td class=td-0>", $theKey, " <br/>flag:", $r['VALUE'][$theKey]['stat']['flag'], " <br/>Size:", bsize($r['VALUE'][$theKey]['stat']['size']), "</td><td>", chunk_split($r['VALUE'][$theKey]['value'], 40), "</td></tr>";
        echo <<<EOB
\t\t\t</tbody></table>
\t\t\t</div><hr/>
EOB;
        break;
}
echo getFooter();
开发者ID:42medien,项目名称:spreadly,代码行数:31,代码来源:memcache.php

示例11: bsize

                            name: 'Host Status Diagrams - Memory Usage',
                            data: [
                                ['Cached Files - ' + '<?php 
echo $size_files;
?>
',   <?php 
echo $cache['mem_size'];
?>
 ],
                                ['Cached Variables - ' + '<?php 
echo $size_vars;
?>
',  <?php 
echo $cache_user['mem_size'];
?>
],
                                ['Free Space - ' + '<?php 
echo bsize($mem_avail);
?>
',    <?php 
echo $mem_avail;
?>
]
                            ]
                        }]
                    });
                });
            </script>
        </div>
    </div>
</div>
开发者ID:rkaiser0324,项目名称:APC-Admin,代码行数:31,代码来源:status.php

示例12: bsize

 $usedmemstr = bsize($usedmem);
 $freemem = @$opcache_status['memory_usage']['free_memory'] ?: 0;
 $freememstr = bsize($freemem);
 $totalmem = $usedmem + $freemem;
 $wastedmem = @$opcache_status['memory_usage']['wasted_memory'] ?: 0;
 $wastedmemstr = bsize($wastedmem);
 if ($totalmem) {
     $memory = array('total' => bsize($totalmem), 'used' => $usedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $usedmem / $totalmem * 100) : ''), 'free' => $freememstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $freemem / $totalmem * 100) : ''), 'wasted' => $wastedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $wastedmem / $totalmem * 100) : ''));
 }
 if (isset($opcache_status['interned_strings_usage'])) {
     $usedstring = @$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
     $usedstringstr = bsize($usedstring);
     $freestring = @$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
     $freestringstr = bsize($freestring);
     $totalstring = $usedstring + $freestring;
     $stringbuffer = array('total' => bsize($totalstring), 'used' => $usedstringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $usedstring / $totalstring * 100) : ''), 'free' => $freestringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $freestring / $totalstring * 100) : ''), 'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0, 0, '.', ' '));
 }
 $usedkey = @$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
 $usedkeystr = number_format($usedkey, 0, '.', ' ');
 $totalkey = @$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
 $wastedkey = $usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
 if (isset($opcache_status['opcache_statistics'])) {
     $keystat = array('total' => number_format($totalkey, 0, '.', ' '), 'used' => $usedkeystr . ($totalkey > 0 ? sprintf(" (%.1f %%)", $usedkey / $totalkey * 100) : ''), 'wasted' => number_format($wastedkey, 0, '.', ' ') . ($totalkey > 0 ? sprintf(" (%.1f %%)", $wastedkey / $totalkey * 100) : ''));
 }
 $blacklistlines = '';
 if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
     foreach ($opcache_info['blacklist'] as $value) {
         eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
     }
 }
 eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
开发者ID:lamlai,项目名称:Froxlor,代码行数:31,代码来源:admin_opcacheinfo.php

示例13: htmlentities

        }
        // I'm not doing anything to check the validity of the key string.
        // probably an exploit can be written to delete all the files in key=base64_encode("\n\r delete all").
        // somebody has to do a fix to this.
        $theKey = htmlentities(base64_decode($_GET['key']));

        $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
        list($h,$p) = explode(':',$theserver);
        $r = sendMemcacheCommand($h,$p,'get '.$theKey);
        echo <<<EOB
        <div class="info"><table cellspacing=0><tbody>
			<tr><th>Server<th>Key</th><th>Value</th><th>Delete</th></tr>
EOB;
        echo "<tr><td class=td-0>",$theserver,"</td><td class=td-0>",$theKey,
             " <br/>flag:",$r['VALUE'][$theKey]['stat']['flag'],
             " <br/>Size:",bsize($r['VALUE'][$theKey]['stat']['size']),
             "</td><td>",chunk_split($r['VALUE'][$theKey]['value'],40),"</td>",
             '<td><a href="',$PHP_SELF,'&op=5&server=',(int)$_GET['server'],'&key=',base64_encode($theKey),"\">Delete</a></td>","</tr>";
        echo <<<EOB
			</tbody></table>
			</div><hr/>
EOB;
    break;
    case 5: // item delete
    	if (!isset($_GET['key']) || !isset($_GET['server'])){
			echo "No key set!";
			break;
        }
        $theKey = htmlentities(base64_decode($_GET['key']));
		$theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
		list($h,$p) = explode(':',$theserver);
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:31,代码来源:mem.php

示例14: indexAction


//.........这里部分代码省略.........
                                    fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
                                    if ($angle_to - $angle_from > 0.05) {
                                        array_push($string_placement, array($angle_from, $angle_to));
                                    }
                                }
                                $angle_from = $angle_to;
                            }
                            $angle_to = $angle_from + $block['size'] / $s;
                            if ($angle_to + $fuzz > 1) {
                                $angle_to = 1;
                            }
                            if ($angle_to * 360 - $angle_from * 360 >= 1) {
                                fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
                                if ($angle_to - $angle_from > 0.05) {
                                    array_push($string_placement, array($angle_from, $angle_to));
                                }
                            }
                            $angle_from = $angle_to;
                            $ptr = $block['offset'] + $block['size'];
                        }
                        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);
                            if ($angle_to - $angle_from > 0.05) {
                                array_push($string_placement, array($angle_from, $angle_to));
                            }
                        }
                    }
                    foreach ($string_placement as $angle) {
                        text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
                    }
                    break;
                case 2:
                    $s = $cache['num_hits'] + $cache['num_misses'];
                    $a = $cache['num_hits'];
                    fill_box($image, 30, $size, 50, -$a * ($size - 21) / $s, $col_black, $col_green, sprintf("%.1f%%", $cache['num_hits'] * 100 / $s));
                    fill_box($image, 130, $size, 50, -max(4, ($s - $a) * ($size - 21) / $s), $col_black, $col_red, sprintf("%.1f%%", $cache['num_misses'] * 100 / $s));
                    break;
                case 3:
                    $s = $mem['num_seg'] * $mem['seg_size'];
                    $a = $mem['avail_mem'];
                    $x = 130;
                    $y = 1;
                    $j = 1;
                    // 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++) {
                        $ptr = 0;
                        $free = $mem['block_lists'][$i];
                        foreach ($free as $block) {
                            if ($block['offset'] != $ptr) {
                                // Used block
                                $h = (GRAPH_SIZE - 5) * ($block['offset'] - $ptr) / $s;
                                if ($h > 0) {
                                    $j++;
                                    if ($j < 75) {
                                        fill_box($image, $x, $y, 50, $h, $col_black, $col_red, bsize($block['offset'] - $ptr), $j);
                                    } else {
                                        fill_box($image, $x, $y, 50, $h, $col_black, $col_red);
                                    }
                                }
                                $y += $h;
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:67,代码来源:ApcController.php

示例15: foreach

    foreach ($keys as $k) {
        if (strpos($k, "ITEM") === 0) {
            $item = str_replace("ITEM ", "", $k);
            $item_parts = explode(" ", $item);
            $items_count++;
            $o = process_item($item_parts[0]);
            $output[] = $o;
            show_line(str_pad($o['size'], 15, " ") . " " . $o['key']);
        }
    }
}
show_line('');
show_line('');
show_line('');
show_line("ITEM COUNT : {$items_count}");
show_line("TOTAL SIZE: {$total_size}, " . bsize($total_size));
//echo execute("stats cachedump 32 10");
function process_item($i)
{
    $name = $i;
    $content = sendMemcacheCommand("get {$i}");
    if (isset($content['VALUE'])) {
        $size = $content['VALUE'][$i]['stat']['size'];
        global $total_size;
        $total_size += $size;
    } else {
        $size = "?";
    }
    return array("size" => $size, "key" => $i);
}
function execute($q)
开发者ID:raphael-riel,项目名称:workstation,代码行数:31,代码来源:memcache_dump.php


注:本文中的bsize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。