Project

General

Profile

« Previous | Next » 

Revision 4a83831c

Added by Jim Pingle about 12 years ago

Add a meter for states, too

View differences:

usr/local/www/includes/functions.inc.php
22 22
	$stats['cpufreq'] = get_cpufreq();
23 23
	$stats['load_average'] = get_load_average();
24 24
	$stats['mbuf'] = get_mbuf();
25
	$stats['statepercent'] = get_pfstate(true);
25 26
	$stats = join("|", $stats);
26 27
	return $stats;
27 28
}
......
138 139
	return $cpuUsage;
139 140
}
140 141

  
141
function get_pfstate() {
142
function get_pfstate($percent=false) {
142 143
	global $config;
143 144
	$matches = "";
144 145
	if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0)
......
149 150
	if (preg_match("/([0-9]+)/", $curentries, $matches)) {
150 151
		$curentries = $matches[1];
151 152
	}
152
	return $curentries . "/" . $maxstates;
153
	if ($percent)
154
		return ($curentries / $maxstates) * 100;
155
	else
156
		return $curentries . "/" . $maxstates;
153 157
}
154 158

  
155 159
function has_temp() {

Also available in: Unified diff