12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace PhpMyAdmin;
- use PhpMyAdmin\SysInfoBase;
- class SysInfoSunOS extends SysInfoBase
- {
- public $os = 'SunOS';
-
- private function _kstat($key)
- {
- if ($m = shell_exec('kstat -p d ' . $key)) {
- list(, $value) = preg_split("/\t/", trim($m), 2);
- return $value;
- } else {
- return '';
- }
- }
-
- public function loadavg()
- {
- $load1 = $this->_kstat('unix:0:system_misc:avenrun_1min');
- return array('loadavg' => $load1);
- }
-
- public function supported()
- {
- return @is_readable('/proc/meminfo');
- }
-
- public function memory()
- {
- $pagesize = $this->_kstat('unix:0:seg_cache:slab_size');
- $mem = array();
- $mem['MemTotal']
- = $this->_kstat('unix:0:system_pages:pagestotal') * $pagesize;
- $mem['MemUsed']
- = $this->_kstat('unix:0:system_pages:pageslocked') * $pagesize;
- $mem['MemFree']
- = $this->_kstat('unix:0:system_pages:pagesfree') * $pagesize;
- $mem['SwapTotal'] = $this->_kstat('unix:0:vminfo:swap_avail') / 1024;
- $mem['SwapUsed'] = $this->_kstat('unix:0:vminfo:swap_alloc') / 1024;
- $mem['SwapFree'] = $this->_kstat('unix:0:vminfo:swap_free') / 1024;
- return $mem;
- }
- }
|