2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Hold PMA\libraries\SysInfoLinux class
8 namespace PMA\libraries
;
11 * Linux based SysInfo class
13 * @package PhpMyAdmin-sysinfo
15 class SysInfoLinux
extends \PMA\libraries\SysInfo
20 * Gets load information
22 * @return array with load data
26 $buf = file_get_contents('/proc/stat');
37 'busy' => $nums[1] +
$nums[2] +
$nums[3],
38 'idle' => intval($nums[4]),
43 * Checks whether class is supported in this environment
45 * @return true on success
47 public function supported()
49 return @is_readable
('/proc/meminfo') && @is_readable
('/proc/stat');
53 * Gets information about memory usage
55 * @return array with memory usage data
61 file_get_contents('/proc/meminfo'),
65 $mem = array_combine($matches[1], $matches[2]);
77 $mem = array_merge($defaults, $mem);
79 foreach ($mem as $idx => $value) {
80 $mem[$idx] = intval($value);
83 $mem['MemUsed'] = $mem['MemTotal']
84 - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
86 $mem['SwapUsed'] = $mem['SwapTotal']
87 - $mem['SwapFree'] - $mem['SwapCached'];