added more debugging infos

This commit is contained in:
Steffen Vogel 2011-07-22 10:34:46 +02:00
parent 037cc28879
commit e0741e2d98
2 changed files with 7 additions and 3 deletions

View file

@ -60,6 +60,7 @@ class CapabilitiesController extends Controller {
if ($load = Util\Debug::getLoadAvg()) $statistics['load'] = $load;
if ($uptime = Util\Debug::getUptime()) $statistics['uptime'] = $uptime*1000;
if ($commit = Util\Debug::getCurrentCommit()) $statistics['commit-hash'] = $commit;
if ($version = phpversion()) $statistics['php-version'] = $version;
$capabilities['statistics'] = $statistics;
}

View file

@ -153,11 +153,14 @@ class Debug {
* @return array average load (1min, 5min, 15min)
*/
public static function getLoadAvg() {
if (file_exists("/proc/loadavg")) {
$load = file_get_contents("/proc/loadavg");
if (function_exists('sys_getloadvg')) {
$load = sys_getloadvg();
}
elseif (file_exists('/proc/loadavg')) {
$load = file_get_contents('/proc/loadavg');
$load = array_slice(explode(' ', $load), 0, 3);
}
elseif (function_exists("shell_exec")) {
elseif (function_exists('shell_exec')) {
$load = explode(', ', substr(shell_exec('uptime'), -16));
}