Changeset 660 for trunk/Modules/TimeMeasure/Measurement/System.php
- Timestamp:
- May 31, 2014, 12:08:52 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/TimeMeasure/Measurement/System.php
r548 r660 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 {
Note:
See TracChangeset
for help on using the changeset viewer.