Simple function for check process nice, by default returns nice of current process:
<?php
public static function getProcessNice ($pid = null) {
if (!$pid) {
$pid = getmypid ();
}
$res = `ps -p $pid -o "%p %n"`;
preg_match ('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
return array ('pid' => (isset ($matches[1]) ? $matches[1] : null), 'nice' => (isset ($matches[2]) ? $matches[2] : null));
}
?>