Changeset 47 for trunk/Application/Model/Measurement/System.php
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 2 1 config.php 2 .project
-
- Property svn:ignore
-
trunk/Application/Model/Measurement/System.php
r44 r47 24 24 25 25 function Ping($Host = 'nix.cz') 26 { 26 { 27 $Row = array(); 27 28 exec('ping '.$Host.' -c 1 -W 1|grep time=', $Row); 28 29 // W - timeout in seconds … … 55 56 $LastCpuUsage = unserialize(file_get_contents($CpuStateFileName)); 56 57 //$cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev; 57 58 58 59 // get processor usage seconds for pct stats ### 59 60 $File = fopen('/proc/stat', 'r'); … … 69 70 $CpuUsageDiffTotal = (($CpuUsageDiff['User'] + $CpuUsageDiff['System']) + $CpuUsageDiff['Idle']); 70 71 if ($CpuUsageDiffTotal > 0) 71 { 72 { 72 73 $CpuUsagePercent['User'] = ($CpuUsageDiff['User'] / $CpuUsageDiffTotal) * 100; 73 74 $CpuUsagePercent['System'] = ($CpuUsageDiff['System'] / $CpuUsageDiffTotal) * 100; … … 93 94 array_shift($Output); // Skip header 94 95 foreach($Output as $Item) 95 { 96 { 96 97 while(strpos($Item, ' ') !== false) $Item = str_replace(' ', ' ', $Item); // Rrmove multiple spaces 97 98 $Item = explode(':', $Item); … … 108 109 $NetworkState[$Interface]['DownAverage'] = 0; 109 110 $NetworkState[$Interface]['UpAverage'] = 0; 110 } 111 } 111 112 if($NetworkState[$Interface]['DownAverage'] < 0) $NetworkState[$Interface]['DownAverage'] = 0; 112 113 if($NetworkState[$Interface]['UpAverage'] < 0) $NetworkState[$Interface]['UpAverage'] = 0; … … 121 122 return($NetworkState['Interface']['DownAverage']); 122 123 } 123 124 124 125 function NetworkSpeedUpload($Interface) 125 126 { … … 177 178 } 178 179 } 179 180 ?>
Note:
See TracChangeset
for help on using the changeset viewer.