2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Hold PhpMyAdmin\SysInfoLinux class
10 use PhpMyAdmin\SysInfo
;
11 use PhpMyAdmin\SysInfoBase
;
14 * Linux based SysInfo class
18 class SysInfoLinux
extends SysInfoBase
23 * Gets load information
25 * @return array with load data
29 $buf = file_get_contents('/proc/stat');
40 'busy' => $nums[1] +
$nums[2] +
$nums[3],
41 'idle' => intval($nums[4]),
46 * Checks whether class is supported in this environment
48 * @return true on success
50 public function supported()
52 return @is_readable
('/proc/meminfo') && @is_readable
('/proc/stat');
56 * Gets information about memory usage
58 * @return array with memory usage data
63 SysInfo
::MEMORY_REGEXP
,
64 file_get_contents('/proc/meminfo'),
68 $mem = array_combine($matches[1], $matches[2]);
80 $mem = array_merge($defaults, $mem);
82 foreach ($mem as $idx => $value) {
83 $mem[$idx] = intval($value);
86 $mem['MemUsed'] = $mem['MemTotal']
87 - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
89 $mem['SwapUsed'] = $mem['SwapTotal']
90 - $mem['SwapFree'] - $mem['SwapCached'];