original_string: function _CPULoad()
  	{
  /*
  
  cpu  524152 2662 2515228 336057010
  cpu0 264339 1408 1257951 168025827
  cpu1 259813 1254 1257277 168031181
  page 622307 25475680
  swap 24 1891
  intr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  disk_io: (3,0):(3144904,54369,610378,3090535,50936192) (3,1):(3630212,54097,633016,3576115,50951320)
  ctxt 66155838
  btime 1062315585
  processes 69293
  
  */
  		// Algorithm is taken from
  		// http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/414b0e1b-499c-411e-8a02-6a12e339c0f1/
  		if (strncmp(PHP_OS,'WIN',3)==0) {
  			if (PHP_VERSION == '5.0.0') return false;
  			if (PHP_VERSION == '5.0.1') return false;
  			if (PHP_VERSION == '5.0.2') return false;
  			if (PHP_VERSION == '5.0.3') return false;
  			if (PHP_VERSION == '4.3.10') return false; # see http://bugs.php.net/bug.php?id=31737
  
  			static $FAIL = false;
  			if ($FAIL) return false;
  
  			$objName = "winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\CIMV2";
  			$myQuery = "SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'";
  
  			try {
  				@$objWMIService = new COM($objName);
  				if (!$objWMIService) {
  					$FAIL = true;
  					return false;
  				}
  
  				$info[0] = -1;
  				$info[1] = 0;
  				$info[2] = 0;
  				$info[3] = 0;
  				foreach($objWMIService->ExecQuery($myQuery) as $objItem)  {
  						$info[0] = $objItem->PercentProcessorTime();
  				}
  
  			} catch(Exception $e) {
  				$FAIL = true;
  				echo $e->getMessage();
  				return false;
  			}
  
  			return $info;
  		}
  
  		// Algorithm - Steve Blinch (BlitzAffe Online, http://www.blitzaffe.com)
  		$statfile = '/proc/stat';
  		if (!file_exists($statfile)) return false;
  
  		$fd = fopen($statfile,"r");
  		if (!$fd) return false;
  
  		$statinfo = explode("\n",fgets($fd, 1024));
  		fclose($fd);
  		foreach($statinfo as $line) {
  			$info = explode(" ",$line);
  			if($info[0]=="cpu") {
  				array_shift($info);  // pop off "cpu"
  				if(!$info[0]) array_shift($info); // pop off blank space (if any)
  				return $info;
  			}
  		}
  
  		return false;
  
  	}
code: function _CPULoad()
  	{
  /*
  
  cpu  524152 2662 2515228 336057010
  cpu0 264339 1408 1257951 168025827
  cpu1 259813 1254 1257277 168031181
  page 622307 25475680
  swap 24 1891
  intr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  disk_io: (3,0):(3144904,54369,610378,3090535,50936192) (3,1):(3630212,54097,633016,3576115,50951320)
  ctxt 66155838
  btime 1062315585
  processes 69293
  
  */
  		// Algorithm is taken from
  		// http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/414b0e1b-499c-411e-8a02-6a12e339c0f1/
  		if (strncmp(PHP_OS,'WIN',3)==0) {
  			if (PHP_VERSION == '5.0.0') return false;
  			if (PHP_VERSION == '5.0.1') return false;
  			if (PHP_VERSION == '5.0.2') return false;
  			if (PHP_VERSION == '5.0.3') return false;
  			if (PHP_VERSION == '4.3.10') return false; # see http://bugs.php.net/bug.php?id=31737
  
  			static $FAIL = false;
  			if ($FAIL) return false;
  
  			$objName = "winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\CIMV2";
  			$myQuery = "SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'";
  
  			try {
  				@$objWMIService = new COM($objName);
  				if (!$objWMIService) {
  					$FAIL = true;
  					return false;
  				}
  
  				$info[0] = -1;
  				$info[1] = 0;
  				$info[2] = 0;
  				$info[3] = 0;
  				foreach($objWMIService->ExecQuery($myQuery) as $objItem)  {
  						$info[0] = $objItem->PercentProcessorTime();
  				}
  
  			} catch(Exception $e) {
  				$FAIL = true;
  				echo $e->getMessage();
  				return false;
  			}
  
  			return $info;
  		}
  
  		// Algorithm - Steve Blinch (BlitzAffe Online, http://www.blitzaffe.com)
  		$statfile = '/proc/stat';
  		if (!file_exists($statfile)) return false;
  
  		$fd = fopen($statfile,"r");
  		if (!$fd) return false;
  
  		$statinfo = explode("\n",fgets($fd, 1024));
  		fclose($fd);
  		foreach($statinfo as $line) {
  			$info = explode(" ",$line);
  			if($info[0]=="cpu") {
  				array_shift($info);  // pop off "cpu"
  				if(!$info[0]) array_shift($info); // pop off blank space (if any)
  				return $info;
  			}
  		}
  
  		return false;
  
  	}
code_tokens: function _CPULoad ( ) { /*
  
  cpu  524152 2662 2515228 336057010
  cpu0 264339 1408 1257951 168025827
  cpu1 259813 1254 1257277 168031181
  page 622307 25475680
  swap 24 1891
  intr 890153570 868093576 6 0 4 4 0 6 1 2 0 0 0 124 0 8098760 2 13961053 0 0 0 0 0 0 0 0 0 0 0 0 0 16 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  disk_io: (3,0):(3144904,54369,610378,3090535,50936192) (3,1):(3630212,54097,633016,3576115,50951320)
  ctxt 66155838
  btime 1062315585
  processes 69293
  
  */ // Algorithm is taken from // http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/414b0e1b-499c-411e-8a02-6a12e339c0f1/ if ( strncmp ( PHP_OS , 'WIN' , 3 ) == 0 ) { if ( PHP_VERSION == '5.0.0' ) return false ; if ( PHP_VERSION == '5.0.1' ) return false ; if ( PHP_VERSION == '5.0.2' ) return false ; if ( PHP_VERSION == '5.0.3' ) return false ; if ( PHP_VERSION == '4.3.10' ) return false ; # see http://bugs.php.net/bug.php?id=31737 static $ FAIL = false ; if ( $ FAIL ) return false ; $ objName = "winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\CIMV2" ; $ myQuery = "SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'" ; try { @ $ objWMIService = new COM ( $ objName ) ; if ( ! $ objWMIService ) { $ FAIL = true ; return false ; } $ info [ 0 ] = - 1 ; $ info [ 1 ] = 0 ; $ info [ 2 ] = 0 ; $ info [ 3 ] = 0 ; foreach ( $ objWMIService -> ExecQuery ( $ myQuery ) as $ objItem ) { $ info [ 0 ] = $ objItem -> PercentProcessorTime ( ) ; } } catch ( Exception $ e ) { $ FAIL = true ; echo $ e -> getMessage ( ) ; return false ; } return $ info ; } // Algorithm - Steve Blinch (BlitzAffe Online, http://www.blitzaffe.com) $ statfile = '/proc/stat' ; if ( ! file_exists ( $ statfile ) ) return false ; $ fd = fopen ( $ statfile , "r" ) ; if ( ! $ fd ) return false ; $ statinfo = explode ( "\n" , fgets ( $ fd , 1024 ) ) ; fclose ( $ fd ) ; foreach ( $ statinfo as $ line ) { $ info = explode ( " " , $ line ) ; if ( $ info [ 0 ] == "cpu" ) { array_shift ( $ info ) ; // pop off "cpu" if ( ! $ info [ 0 ] ) array_shift ( $ info ) ; // pop off blank space (if any) return $ info ; } } return false ; }
docstring: returns array with info to calculate CPU Load
docstring_tokens: returns array with info to calculate CPU Load