Source for file Parser.php
Documentation is available at Parser.php
// +----------------------------------------------------------------------+
// | PEAR :: System :: ProcWatch :: Parser |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is available at http://www.php.net/license/3_0.txt |
// | If you did not receive a copy of the PHP license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003-2004 Michael Wallner <mike@iworks.at> |
// +----------------------------------------------------------------------+
// $Id: Parser.php 304228 2010-10-10 03:05:12Z clockwerx $
* System_ProcWatch_Parser
* Fetches output from `ps` and parses it into an associative array
* $ps = &new System_ProcWatch_Parser();
* $pd = &$ps->getParsedData();
* @author Michael Wallner <mike@php.net>
* @package System_ProcWatch
* @version $Revision: 304228 $
* @return object System_ProcWatch_Parser
* @param string $ps_args ps' args
* @return object System_ProcWatch_Parser
* @param string $ps_args ps' args
* @return string ps' output
* @param string $ps_args ps' args
function fetch($ps_args = '')
foreach($lines as $i => $line){
foreach ($heads as $j => $head) {
$procs[$i][$head] = str_replace('"', '\"', $parts[$j]);
* @param string $ps_args ps' arguments
* @param bool $refresh whether to refresh our data
if ($refresh || empty ($this->_procs)) {
$this->_procs = &$this->parse($this->fetch($ps_args));
* Get info about a process by its PID
* @param int $pid the PID of the process
if ($proc['pid'] == $pid) {
* Get information about processes
* @param string $pattern PCRE to match for process
* @param string $search the ps field to search for
Documentation generated on Mon, 11 Mar 2019 15:39:51 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|