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


PHP mem_usage函数代码示例

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


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

示例1: get_stats

function get_stats() {
	$stats['cpu'] = cpu_usage();
	$stats['mem'] = mem_usage();
	$stats['uptime'] = get_uptime();
	$stats['states'] = get_pfstate();
	$stats['temp'] = get_temp();
	$stats['datetime'] = update_date_time();
	$stats['interfacestatistics'] = get_interfacestats();
	$stats['interfacestatus'] = get_interfacestatus();
	$stats['gateways'] = get_gatewaystats();
	$stats = join("|", $stats);
	return $stats;
}
开发者ID:rdmenezes,项目名称:pfsense,代码行数:13,代码来源:functions.inc.php

示例2: get_stats

function get_stats()
{
    $stats['cpu'] = cpu_usage();
    $stats['mem'] = mem_usage();
    $stats['uptime'] = get_uptime();
    $stats['states'] = get_pfstate();
    $stats['temp'] = get_temp();
    $stats['datetime'] = update_date_time();
    $stats['interfacestatistics'] = get_interfacestats();
    $stats['interfacestatus'] = get_interfacestatus();
    $stats['cpufreq'] = get_cpufreq();
    $stats['load_average'] = get_load_average();
    $stats['mbuf'] = get_mbuf();
    $stats['mbufpercent'] = get_mbuf(true);
    $stats['statepercent'] = get_pfstate(true);
    $stats = join("|", $stats);
    return $stats;
}
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:18,代码来源:functions.inc.php

示例3: gettext

					</div>
				</div>
				<span id="cpumeter"><?php 
echo gettext('(Updating in 10 seconds)');
?>
</span>
			</td>
		</tr>
		<tr>
			<th><?php 
echo gettext("Memory usage");
?>
</th>
			<td>
				<?php 
$memUsage = mem_usage();
?>

				<div class="progress" >
					<div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?php 
echo $memUsage;
?>
" aria-valuemin="0" aria-valuemax="100" style="width: <?php 
echo $memUsage;
?>
%">
					</div>
				</div>
				<span id="memusagemeter"><?php 
echo $memUsage;
?>
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:system_information.widget.php

示例4: loop_status

function loop_status($lcd)
{
    global $g;
    global $config;
    $lcdproc_screens_config = $config['installedpackages']['lcdprocscreens']['config'][0];
    $lcdpanel_width = get_lcdpanel_width();
    $lcdpanel_height = get_lcdpanel_height();
    if (empty($g['product_name'])) {
        $g['product_name'] = "pfSense";
    }
    $version = @file_get_contents("/etc/version");
    $version = trim($version);
    $refresh_frequency = get_lcdpanel_refresh_frequency();
    /* keep a counter to see how many times we can loop */
    $i = 1;
    while ($i) {
        /* prepare the summary data */
        if ($lcdpanel_height >= "4") {
            $summary_states = split("/", get_pfstate());
            $lcd_summary_data = sprintf("%02d%% %02d%% %6d", cpu_usage(), mem_usage(), $summary_states[0]);
        } else {
            $lcd_summary_data = "";
        }
        $lcd_cmds = array();
        $lcd_cmds[] = "widget_set welcome_scr title_wdgt \"Welcome to\"";
        $lcd_cmds[] = "widget_set welcome_scr text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$g['product_name']} {$version}\"";
        add_summary_values($lcd_cmds, "welcome_scr", $lcd_summary_data, $lcdpanel_width);
        /* process screens to display */
        foreach ((array) $lcdproc_screens_config as $name => $screen) {
            if ($screen != "on") {
                continue;
            }
            switch ($name) {
                case "scr_time":
                    $time = date("n/j/Y H:i");
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ System Time\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$time}\"";
                    break;
                case "scr_uptime":
                    $uptime = get_uptime_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ System Uptime\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$uptime}\"";
                    break;
                case "scr_hostname":
                    exec("/bin/hostname", $output, $ret);
                    $hostname = $output[0];
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ System Name\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$hostname}\"";
                    break;
                case "scr_system":
                    $processor = cpu_usage();
                    $memory = mem_usage();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ System Stats\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"CPU {$processor}%, Mem {$memory}%\"";
                    break;
                case "scr_disk":
                    $disk = disk_usage();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ Disk Use\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"Disk {$disk}%\"";
                    break;
                case "scr_load":
                    $loadavg = get_loadavg_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ Load Averages\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$loadavg}\"";
                    break;
                case "scr_states":
                    $states = get_pfstate();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ Traffic States\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"Curr/Max {$states}\"";
                    break;
                case "scr_carp":
                    $carp = get_carp_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ CARP State\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$carp}\"";
                    break;
                case "scr_ipsec":
                    $ipsec = get_ipsec_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ IPsec Tunnels\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$ipsec}\"";
                    break;
                case "scr_slbd":
                    $slbd = get_slbd_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ Load Balancer\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$slbd}\"";
                    break;
                case "scr_interfaces":
                    $interfaces = get_interfaces_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ Interfaces\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$interfaces}\"";
                    break;
                case "scr_mbuf":
                    $mbufstats = get_mbuf_stats();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ MBuf Usage\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$mbufstats}\"";
                    break;
                case "scr_cpufrequency":
                    $cpufreq = get_cpufrequency();
                    $lcd_cmds[] = "widget_set {$name} title_wdgt 1 1 \"+ CPU Frequency\"";
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 2 \"{$cpufreq}\"";
                    break;
//.........这里部分代码省略.........
开发者ID:MarkVLK,项目名称:pfsense-packages,代码行数:101,代码来源:lcdproc_client.php

示例5: loop_status

function loop_status($lcd)
{
    global $g;
    global $config;
    global $lcdproc_connect_errors;
    $lcdproc_screens_config = $config['installedpackages']['lcdprocscreens']['config'][0];
    $lcdpanel_width = get_lcdpanel_width();
    $lcdpanel_height = get_lcdpanel_height();
    if (empty($g['product_name'])) {
        $g['product_name'] = "pfSense";
    }
    $refresh_frequency = get_lcdpanel_refresh_frequency();
    /* keep a counter to see how many times we can loop */
    $i = 1;
    while ($i) {
        /* prepare the summary data */
        if ($lcdpanel_height >= "4") {
            $summary_states = split("/", get_pfstate());
            $lcd_summary_data = sprintf("%02d%% %02d%% %6d", cpu_usage(), mem_usage(), $summary_states[0]);
            if ($lcdpanel_width > "16") {
                $lcd_summary_data = $lcd_summary_data . sprintf(" %3d%%", get_cpufrequency_perc());
            }
        } else {
            $lcd_summary_data = "";
        }
        $lcd_cmds = array();
        /* initializes the widget counter */
        $widget_counter = 0;
        /* controls the output leds */
        if (outputled_enabled_CFontz633()) {
            $led_output_value = 0;
            /* LED 1: Interface status */
            if (substr_count(get_interfaces_stats(), "Down") > 0) {
                $led_output_value = $led_output_value + pow(2, 0);
            } else {
                $led_output_value = $led_output_value + pow(2, 4);
            }
            /* LED 2: CARP status */
            switch (outputled_carp()) {
                case -1:
                    /* CARP disabled */
                /* CARP disabled */
                case 0:
                    $led_output_value = $led_output_value + pow(2, 1);
                case 1:
                    $led_output_value = $led_output_value + pow(2, 5);
            }
            /* LED 3: CPU Usage */
            if (cpu_usage() > 50) {
                $led_output_value = $led_output_value + pow(2, 2);
            } else {
                $led_output_value = $led_output_value + pow(2, 6);
            }
            /* LED 4: Gateway status */
            switch (outputled_gateway()) {
                case -1:
                    /* Gateways not configured */
                /* Gateways not configured */
                case 0:
                    $led_output_value = $led_output_value + 2 ^ 3;
                case 1:
                    $led_output_value = $led_output_value + 2 ^ 7;
            }
            /* Sends the command to the panel */
            $lcd_cmds[] = "output {$led_output_value}";
        }
        /* process screens to display */
        foreach ((array) $lcdproc_screens_config as $name => $screen) {
            if ($screen != "on") {
                continue;
            }
            switch ($name) {
                case "scr_version":
                    $version = get_version();
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$version}\"";
                    break;
                case "scr_time":
                    $time = date("n/j/Y H:i");
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$time}\"";
                    break;
                case "scr_uptime":
                    $uptime = get_uptime_stats();
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$uptime}\"";
                    break;
                case "scr_hostname":
                    exec("/bin/hostname", $output, $ret);
                    $hostname = $output[0];
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$hostname}\"";
                    break;
                case "scr_system":
                    $processor = cpu_usage();
                    $memory = mem_usage();
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"CPU {$processor}%, Mem {$memory}%\"";
                    break;
                case "scr_disk":
                    $disk = disk_usage();
                    $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"Disk {$disk}%\"";
                    break;
                case "scr_load":
                    $loadavg = get_loadavg_stats();
//.........这里部分代码省略.........
开发者ID:netceler,项目名称:pfsense-packages,代码行数:101,代码来源:lcdproc_client.php


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