1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* System TO class |
4
|
|
|
* |
5
|
|
|
* PHP version 5 |
6
|
|
|
* |
7
|
|
|
* @category PHP |
8
|
|
|
* @package PSI_TO |
9
|
|
|
* @author Michael Cramer <[email protected]> |
10
|
|
|
* @copyright 2009 phpSysInfo |
11
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
12
|
|
|
* @version SVN: $Id: class.System.inc.php 255 2009-06-17 13:39:41Z bigmichi1 $ |
13
|
|
|
* @link http://phpsysinfo.sourceforge.net |
14
|
|
|
*/ |
15
|
|
|
/** |
16
|
|
|
* System TO class |
17
|
|
|
* |
18
|
|
|
* @category PHP |
19
|
|
|
* @package PSI_TO |
20
|
|
|
* @author Michael Cramer <[email protected]> |
21
|
|
|
* @copyright 2009 phpSysInfo |
22
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
23
|
|
|
* @version Release: 3.0 |
24
|
|
|
* @link http://phpsysinfo.sourceforge.net |
25
|
|
|
*/ |
26
|
|
|
class System |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* name of the host where phpSysInfo runs |
30
|
|
|
* |
31
|
|
|
* @var String |
32
|
|
|
*/ |
33
|
|
|
private $_hostname = "localhost"; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* ip of the host where phpSysInfo runs |
37
|
|
|
* |
38
|
|
|
* @var String |
39
|
|
|
*/ |
40
|
|
|
private $_ip = "127.0.0.1"; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* detailed Information about the kernel |
44
|
|
|
* |
45
|
|
|
* @var String |
46
|
|
|
*/ |
47
|
|
|
private $_kernel = "Unknown"; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* name of the distribution |
51
|
|
|
* |
52
|
|
|
* @var String |
53
|
|
|
*/ |
54
|
|
|
private $_distribution = "Unknown"; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* icon of the distribution (must be available in phpSysInfo) |
58
|
|
|
* |
59
|
|
|
* @var String |
60
|
|
|
*/ |
61
|
|
|
private $_distributionIcon = "unknown.png"; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* detailed Information about the machine name |
65
|
|
|
* |
66
|
|
|
* @var String |
67
|
|
|
*/ |
68
|
|
|
private $_machine = ""; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* time in sec how long the system is running |
72
|
|
|
* |
73
|
|
|
* @var Integer |
74
|
|
|
*/ |
75
|
|
|
private $_uptime = 0; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* count of users that are currently logged in |
79
|
|
|
* |
80
|
|
|
* @var Integer |
81
|
|
|
*/ |
82
|
|
|
private $_users = 0; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* load of the system |
86
|
|
|
* |
87
|
|
|
* @var String |
88
|
|
|
*/ |
89
|
|
|
private $_load = ""; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* load of the system in percent (all cpus, if more than one) |
93
|
|
|
* |
94
|
|
|
* @var Integer |
95
|
|
|
*/ |
96
|
|
|
private $_loadPercent = null; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* array with cpu devices |
100
|
|
|
* |
101
|
|
|
* @see CpuDevice |
102
|
|
|
* |
103
|
|
|
* @var Array |
104
|
|
|
*/ |
105
|
|
|
private $_cpus = array(); |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* array with network devices |
109
|
|
|
* |
110
|
|
|
* @see NetDevice |
111
|
|
|
* |
112
|
|
|
* @var Array |
113
|
|
|
*/ |
114
|
|
|
private $_netDevices = array(); |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* array with pci devices |
118
|
|
|
* |
119
|
|
|
* @see HWDevice |
120
|
|
|
* |
121
|
|
|
* @var Array |
122
|
|
|
*/ |
123
|
|
|
private $_pciDevices = array(); |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* array with ide devices |
127
|
|
|
* |
128
|
|
|
* @see HWDevice |
129
|
|
|
* |
130
|
|
|
* @var Array |
131
|
|
|
*/ |
132
|
|
|
private $_ideDevices = array(); |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* array with scsi devices |
136
|
|
|
* |
137
|
|
|
* @see HWDevice |
138
|
|
|
* |
139
|
|
|
* @var Array |
140
|
|
|
*/ |
141
|
|
|
private $_scsiDevices = array(); |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* array with usb devices |
145
|
|
|
* |
146
|
|
|
* @see HWDevice |
147
|
|
|
* |
148
|
|
|
* @var Array |
149
|
|
|
*/ |
150
|
|
|
private $_usbDevices = array(); |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* array with thunderbolt devices |
154
|
|
|
* |
155
|
|
|
* @see HWDevice |
156
|
|
|
* |
157
|
|
|
* @var Array |
158
|
|
|
*/ |
159
|
|
|
private $_tbDevices = array(); |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* array with I2C devices |
163
|
|
|
* |
164
|
|
|
* @see HWDevice |
165
|
|
|
* |
166
|
|
|
* @var Array |
167
|
|
|
*/ |
168
|
|
|
private $_i2cDevices = array(); |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* array with disk devices |
172
|
|
|
* |
173
|
|
|
* @see DiskDevice |
174
|
|
|
* |
175
|
|
|
* @var Array |
176
|
|
|
*/ |
177
|
|
|
private $_diskDevices = array(); |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* free memory in bytes |
181
|
|
|
* |
182
|
|
|
* @var Integer |
183
|
|
|
*/ |
184
|
|
|
private $_memFree = 0; |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* total memory in bytes |
188
|
|
|
* |
189
|
|
|
* @var Integer |
190
|
|
|
*/ |
191
|
|
|
private $_memTotal = 0; |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* used memory in bytes |
195
|
|
|
* |
196
|
|
|
* @var Integer |
197
|
|
|
*/ |
198
|
|
|
private $_memUsed = 0; |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* used memory by applications in bytes |
202
|
|
|
* |
203
|
|
|
* @var Integer |
204
|
|
|
*/ |
205
|
|
|
private $_memApplication = null; |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* used memory for buffers in bytes |
209
|
|
|
* |
210
|
|
|
* @var Integer |
211
|
|
|
*/ |
212
|
|
|
private $_memBuffer = null; |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* used memory for cache in bytes |
216
|
|
|
* |
217
|
|
|
* @var Integer |
218
|
|
|
*/ |
219
|
|
|
private $_memCache = null; |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* array with swap devices |
223
|
|
|
* |
224
|
|
|
* @see DiskDevice |
225
|
|
|
* |
226
|
|
|
* @var Array |
227
|
|
|
*/ |
228
|
|
|
private $_swapDevices = array(); |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* array of types of processes |
232
|
|
|
* |
233
|
|
|
* @var Array |
234
|
|
|
*/ |
235
|
|
|
private $_processes = array(); |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* remove duplicate Entries and Count |
239
|
|
|
* |
240
|
|
|
* @param Array $arrDev list of HWDevices |
241
|
|
|
* |
242
|
|
|
* @see HWDevice |
243
|
|
|
* |
244
|
|
|
* @return Array |
245
|
|
|
*/ |
246
|
|
|
public static function removeDupsAndCount($arrDev) |
247
|
|
|
{ |
248
|
|
|
$result = array(); |
249
|
|
|
foreach ($arrDev as $dev) { |
250
|
|
|
if (count($result) === 0) { |
251
|
|
|
array_push($result, $dev); |
252
|
|
|
} else { |
253
|
|
|
$found = false; |
254
|
|
|
foreach ($result as $tmp) { |
255
|
|
|
if ($dev->equals($tmp)) { |
256
|
|
|
$tmp->setCount($tmp->getCount() + 1); |
257
|
|
|
$found = true; |
258
|
|
|
break; |
259
|
|
|
} |
260
|
|
|
} |
261
|
|
|
if (!$found) { |
262
|
|
|
array_push($result, $dev); |
263
|
|
|
} |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
return $result; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* return percent of used memory |
272
|
|
|
* |
273
|
|
|
* @see System::_memUsed |
274
|
|
|
* @see System::_memTotal |
275
|
|
|
* |
276
|
|
|
* @return Integer |
|
|
|
|
277
|
|
|
*/ |
278
|
|
|
public function getMemPercentUsed() |
279
|
|
|
{ |
280
|
|
|
if ($this->_memTotal > 0) { |
281
|
|
|
return round($this->_memUsed / $this->_memTotal * 100); |
282
|
|
|
} else { |
283
|
|
|
return 0; |
284
|
|
|
} |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* return percent of used memory for applications |
289
|
|
|
* |
290
|
|
|
* @see System::_memApplication |
291
|
|
|
* @see System::_memTotal |
292
|
|
|
* |
293
|
|
|
* @return Integer |
|
|
|
|
294
|
|
|
*/ |
295
|
|
|
public function getMemPercentApplication() |
296
|
|
|
{ |
297
|
|
|
if ($this->_memApplication !== null) { |
298
|
|
|
if (($this->_memApplication > 0) && ($this->_memTotal > 0)) { |
299
|
|
|
return round($this->_memApplication / $this->_memTotal * 100); |
300
|
|
|
} else { |
301
|
|
|
return 0; |
302
|
|
|
} |
303
|
|
|
} else { |
304
|
|
|
return null; |
305
|
|
|
} |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* return percent of used memory for cache |
310
|
|
|
* |
311
|
|
|
* @see System::_memCache |
312
|
|
|
* @see System::_memTotal |
313
|
|
|
* |
314
|
|
|
* @return Integer |
|
|
|
|
315
|
|
|
*/ |
316
|
|
|
public function getMemPercentCache() |
317
|
|
|
{ |
318
|
|
|
if ($this->_memCache !== null) { |
319
|
|
|
if (($this->_memCache > 0) && ($this->_memTotal > 0)) { |
320
|
|
|
if (($this->_memApplication !== null) && ($this->_memApplication > 0)) { |
321
|
|
|
return round(($this->_memCache + $this->_memApplication) / $this->_memTotal * 100) - $this->getMemPercentApplication(); |
322
|
|
|
} else { |
323
|
|
|
return round($this->_memCache / $this->_memTotal * 100); |
324
|
|
|
} |
325
|
|
|
} else { |
326
|
|
|
return 0; |
327
|
|
|
} |
328
|
|
|
} else { |
329
|
|
|
return null; |
330
|
|
|
} |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* return percent of used memory for buffer |
335
|
|
|
* |
336
|
|
|
* @see System::_memBuffer |
337
|
|
|
* @see System::_memTotal |
338
|
|
|
* |
339
|
|
|
* @return Integer |
|
|
|
|
340
|
|
|
*/ |
341
|
|
|
public function getMemPercentBuffer() |
342
|
|
|
{ |
343
|
|
|
if ($this->_memBuffer !== null) { |
344
|
|
|
if (($this->_memBuffer > 0) && ($this->_memTotal > 0)) { |
345
|
|
|
if (($this->_memCache !== null) && ($this->_memCache > 0)) { |
346
|
|
|
if (($this->_memApplication !== null) && ($this->_memApplication > 0)) { |
347
|
|
|
return round(($this->_memBuffer + $this->_memApplication + $this->_memCache) / $this->_memTotal * 100) - $this->getMemPercentApplication() - $this->getMemPercentCache(); |
348
|
|
|
} else { |
349
|
|
|
return round(($this->_memBuffer + $this->_memCache) / $this->_memTotal * 100) - $this->getMemPercentCache(); |
350
|
|
|
} |
351
|
|
|
} elseif (($this->_memApplication !== null) && ($this->_memApplication > 0)) { |
352
|
|
|
return round(($this->_memBuffer + $this->_memApplication) / $this->_memTotal * 100) - $this->getMemPercentApplication(); |
353
|
|
|
} else { |
354
|
|
|
return round($this->_memBuffer / $this->_memTotal * 100); |
355
|
|
|
} |
356
|
|
|
} else { |
357
|
|
|
return 0; |
358
|
|
|
} |
359
|
|
|
} else { |
360
|
|
|
return null; |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Returns total free swap space |
366
|
|
|
* |
367
|
|
|
* @see System::_swapDevices |
368
|
|
|
* @see DiskDevice::getFree() |
369
|
|
|
* |
370
|
|
|
* @return Integer |
|
|
|
|
371
|
|
|
*/ |
372
|
|
|
public function getSwapFree() |
373
|
|
|
{ |
374
|
|
|
if (count($this->_swapDevices) > 0) { |
375
|
|
|
$free = 0; |
376
|
|
|
foreach ($this->_swapDevices as $dev) { |
377
|
|
|
$free += $dev->getFree(); |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
return $free; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
return null; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* Returns total swap space |
388
|
|
|
* |
389
|
|
|
* @see System::_swapDevices |
390
|
|
|
* @see DiskDevice::getTotal() |
391
|
|
|
* |
392
|
|
|
* @return Integer |
|
|
|
|
393
|
|
|
*/ |
394
|
|
|
public function getSwapTotal() |
395
|
|
|
{ |
396
|
|
|
if (count($this->_swapDevices) > 0) { |
397
|
|
|
$total = 0; |
398
|
|
|
foreach ($this->_swapDevices as $dev) { |
399
|
|
|
$total += $dev->getTotal(); |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
return $total; |
403
|
|
|
} else { |
404
|
|
|
return null; |
405
|
|
|
} |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Returns total used swap space |
410
|
|
|
* |
411
|
|
|
* @see System::_swapDevices |
412
|
|
|
* @see DiskDevice::getUsed() |
413
|
|
|
* |
414
|
|
|
* @return Integer |
|
|
|
|
415
|
|
|
*/ |
416
|
|
|
public function getSwapUsed() |
417
|
|
|
{ |
418
|
|
|
if (count($this->_swapDevices) > 0) { |
419
|
|
|
$used = 0; |
420
|
|
|
foreach ($this->_swapDevices as $dev) { |
421
|
|
|
$used += $dev->getUsed(); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
return $used; |
425
|
|
|
} else { |
426
|
|
|
return null; |
427
|
|
|
} |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* return percent of total swap space used |
432
|
|
|
* |
433
|
|
|
* @see System::getSwapUsed() |
434
|
|
|
* @see System::getSwapTotal() |
435
|
|
|
* |
436
|
|
|
* @return Integer |
|
|
|
|
437
|
|
|
*/ |
438
|
|
|
public function getSwapPercentUsed() |
439
|
|
|
{ |
440
|
|
|
if ($this->getSwapTotal() !== null) { |
441
|
|
|
if ($this->getSwapTotal() > 0) { |
442
|
|
|
return round($this->getSwapUsed() / $this->getSwapTotal() * 100); |
443
|
|
|
} else { |
444
|
|
|
return 0; |
445
|
|
|
} |
446
|
|
|
} else { |
447
|
|
|
return null; |
448
|
|
|
} |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* Returns $_distribution. |
453
|
|
|
* |
454
|
|
|
* @see System::$_distribution |
455
|
|
|
* |
456
|
|
|
* @return String |
457
|
|
|
*/ |
458
|
|
|
public function getDistribution() |
459
|
|
|
{ |
460
|
|
|
return $this->_distribution; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* Sets $_distribution. |
465
|
|
|
* |
466
|
|
|
* @param String $distribution distributionname |
467
|
|
|
* |
468
|
|
|
* @see System::$_distribution |
469
|
|
|
* |
470
|
|
|
* @return Void |
471
|
|
|
*/ |
472
|
|
|
public function setDistribution($distribution) |
473
|
|
|
{ |
474
|
|
|
$this->_distribution = $distribution; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* Returns $_distributionIcon. |
479
|
|
|
* |
480
|
|
|
* @see System::$_distributionIcon |
481
|
|
|
* |
482
|
|
|
* @return String |
483
|
|
|
*/ |
484
|
|
|
public function getDistributionIcon() |
485
|
|
|
{ |
486
|
|
|
return $this->_distributionIcon; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* Sets $_distributionIcon. |
491
|
|
|
* |
492
|
|
|
* @param String $distributionIcon distribution icon |
493
|
|
|
* |
494
|
|
|
* @see System::$_distributionIcon |
495
|
|
|
* |
496
|
|
|
* @return Void |
497
|
|
|
*/ |
498
|
|
|
public function setDistributionIcon($distributionIcon) |
499
|
|
|
{ |
500
|
|
|
$this->_distributionIcon = $distributionIcon; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* Returns $_hostname. |
505
|
|
|
* |
506
|
|
|
* @see System::$_hostname |
507
|
|
|
* |
508
|
|
|
* @return String |
509
|
|
|
*/ |
510
|
|
|
public function getHostname() |
511
|
|
|
{ |
512
|
|
|
return $this->_hostname; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* Sets $_hostname. |
517
|
|
|
* |
518
|
|
|
* @param String $hostname hostname |
519
|
|
|
* |
520
|
|
|
* @see System::$_hostname |
521
|
|
|
* |
522
|
|
|
* @return Void |
523
|
|
|
*/ |
524
|
|
|
public function setHostname($hostname) |
525
|
|
|
{ |
526
|
|
|
$this->_hostname = $hostname; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
/** |
530
|
|
|
* Returns $_ip. |
531
|
|
|
* |
532
|
|
|
* @see System::$_ip |
533
|
|
|
* |
534
|
|
|
* @return String |
535
|
|
|
*/ |
536
|
|
|
public function getIp() |
537
|
|
|
{ |
538
|
|
|
return $this->_ip; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* Sets $_ip. |
543
|
|
|
* |
544
|
|
|
* @param String $ip IP |
545
|
|
|
* |
546
|
|
|
* @see System::$_ip |
547
|
|
|
* |
548
|
|
|
* @return Void |
549
|
|
|
*/ |
550
|
|
|
public function setIp($ip) |
551
|
|
|
{ |
552
|
|
|
$this->_ip = $ip; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* Returns $_kernel. |
557
|
|
|
* |
558
|
|
|
* @see System::$_kernel |
559
|
|
|
* |
560
|
|
|
* @return String |
561
|
|
|
*/ |
562
|
|
|
public function getKernel() |
563
|
|
|
{ |
564
|
|
|
return $this->_kernel; |
565
|
|
|
} |
566
|
|
|
|
567
|
|
|
/** |
568
|
|
|
* Sets $_kernel. |
569
|
|
|
* |
570
|
|
|
* @param String $kernel kernelname |
571
|
|
|
* |
572
|
|
|
* @see System::$_kernel |
573
|
|
|
* |
574
|
|
|
* @return Void |
575
|
|
|
*/ |
576
|
|
|
public function setKernel($kernel) |
577
|
|
|
{ |
578
|
|
|
$this->_kernel = $kernel; |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
/** |
582
|
|
|
* Returns $_load. |
583
|
|
|
* |
584
|
|
|
* @see System::$_load |
585
|
|
|
* |
586
|
|
|
* @return String |
587
|
|
|
*/ |
588
|
|
|
public function getLoad() |
589
|
|
|
{ |
590
|
|
|
return $this->_load; |
591
|
|
|
} |
592
|
|
|
|
593
|
|
|
/** |
594
|
|
|
* Sets $_load. |
595
|
|
|
* |
596
|
|
|
* @param String $load current system load |
597
|
|
|
* |
598
|
|
|
* @see System::$_load |
599
|
|
|
* |
600
|
|
|
* @return Void |
601
|
|
|
*/ |
602
|
|
|
public function setLoad($load) |
603
|
|
|
{ |
604
|
|
|
$this->_load = $load; |
605
|
|
|
} |
606
|
|
|
|
607
|
|
|
/** |
608
|
|
|
* Returns $_loadPercent. |
609
|
|
|
* |
610
|
|
|
* @see System::$_loadPercent |
611
|
|
|
* |
612
|
|
|
* @return Integer |
613
|
|
|
*/ |
614
|
|
|
public function getLoadPercent() |
615
|
|
|
{ |
616
|
|
|
return $this->_loadPercent; |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
/** |
620
|
|
|
* Sets $_loadPercent. |
621
|
|
|
* |
622
|
|
|
* @param Integer $loadPercent load percent |
623
|
|
|
* |
624
|
|
|
* @see System::$_loadPercent |
625
|
|
|
* |
626
|
|
|
* @return Void |
627
|
|
|
*/ |
628
|
|
|
public function setLoadPercent($loadPercent) |
629
|
|
|
{ |
630
|
|
|
$this->_loadPercent = $loadPercent; |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
/** |
634
|
|
|
* Returns $_machine. |
635
|
|
|
* |
636
|
|
|
* @see System::$_machine |
637
|
|
|
* |
638
|
|
|
* @return String |
639
|
|
|
*/ |
640
|
|
|
public function getMachine() |
641
|
|
|
{ |
642
|
|
|
return $this->_machine; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
/** |
646
|
|
|
* Sets $_machine. |
647
|
|
|
* |
648
|
|
|
* @param Interger $machine machine |
649
|
|
|
* |
650
|
|
|
* @see System::$_machine |
651
|
|
|
* |
652
|
|
|
* @return Void |
653
|
|
|
*/ |
654
|
|
|
public function setMachine($machine) |
655
|
|
|
{ |
656
|
|
|
$this->_machine = $machine; |
|
|
|
|
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* Returns $_uptime. |
661
|
|
|
* |
662
|
|
|
* @see System::$_uptime |
663
|
|
|
* |
664
|
|
|
* @return Integer |
665
|
|
|
*/ |
666
|
|
|
public function getUptime() |
667
|
|
|
{ |
668
|
|
|
return $this->_uptime; |
669
|
|
|
} |
670
|
|
|
|
671
|
|
|
/** |
672
|
|
|
* Sets $_uptime. |
673
|
|
|
* |
674
|
|
|
* @param Interger $uptime uptime |
675
|
|
|
* |
676
|
|
|
* @see System::$_uptime |
677
|
|
|
* |
678
|
|
|
* @return Void |
679
|
|
|
*/ |
680
|
|
|
public function setUptime($uptime) |
681
|
|
|
{ |
682
|
|
|
$this->_uptime = $uptime; |
|
|
|
|
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* Returns $_users. |
687
|
|
|
* |
688
|
|
|
* @see System::$_users |
689
|
|
|
* |
690
|
|
|
* @return Integer |
691
|
|
|
*/ |
692
|
|
|
public function getUsers() |
693
|
|
|
{ |
694
|
|
|
return $this->_users; |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
/** |
698
|
|
|
* Sets $_users. |
699
|
|
|
* |
700
|
|
|
* @param Integer $users user count |
701
|
|
|
* |
702
|
|
|
* @see System::$_users |
703
|
|
|
* |
704
|
|
|
* @return Void |
705
|
|
|
*/ |
706
|
|
|
public function setUsers($users) |
707
|
|
|
{ |
708
|
|
|
$this->_users = $users; |
709
|
|
|
} |
710
|
|
|
|
711
|
|
|
/** |
712
|
|
|
* Returns $_cpus. |
713
|
|
|
* |
714
|
|
|
* @see System::$_cpus |
715
|
|
|
* |
716
|
|
|
* @return Array |
717
|
|
|
*/ |
718
|
|
|
public function getCpus() |
719
|
|
|
{ |
720
|
|
|
return $this->_cpus; |
721
|
|
|
} |
722
|
|
|
|
723
|
|
|
/** |
724
|
|
|
* Sets $_cpus. |
725
|
|
|
* |
726
|
|
|
* @param Cpu $cpus cpu device |
727
|
|
|
* |
728
|
|
|
* @see System::$_cpus |
729
|
|
|
* @see CpuDevice |
730
|
|
|
* |
731
|
|
|
* @return Void |
732
|
|
|
*/ |
733
|
|
|
public function setCpus($cpus) |
734
|
|
|
{ |
735
|
|
|
array_push($this->_cpus, $cpus); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* Returns $_netDevices. |
740
|
|
|
* |
741
|
|
|
* @see System::$_netDevices |
742
|
|
|
* |
743
|
|
|
* @return Array |
744
|
|
|
*/ |
745
|
|
|
public function getNetDevices() |
746
|
|
|
{ |
747
|
|
|
return $this->_netDevices; |
748
|
|
|
} |
749
|
|
|
|
750
|
|
|
/** |
751
|
|
|
* Sets $_netDevices. |
752
|
|
|
* |
753
|
|
|
* @param NetDevice $netDevices network device |
754
|
|
|
* |
755
|
|
|
* @see System::$_netDevices |
756
|
|
|
* @see NetDevice |
757
|
|
|
* |
758
|
|
|
* @return Void |
759
|
|
|
*/ |
760
|
|
|
public function setNetDevices($netDevices) |
761
|
|
|
{ |
762
|
|
|
array_push($this->_netDevices, $netDevices); |
763
|
|
|
} |
764
|
|
|
|
765
|
|
|
/** |
766
|
|
|
* Returns $_pciDevices. |
767
|
|
|
* |
768
|
|
|
* @see System::$_pciDevices |
769
|
|
|
* |
770
|
|
|
* @return Array |
771
|
|
|
*/ |
772
|
|
|
public function getPciDevices() |
773
|
|
|
{ |
774
|
|
|
return $this->_pciDevices; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* Sets $_pciDevices. |
779
|
|
|
* |
780
|
|
|
* @param HWDevice $pciDevices pci device |
781
|
|
|
* |
782
|
|
|
* @see System::$_pciDevices |
783
|
|
|
* @see HWDevice |
784
|
|
|
* |
785
|
|
|
* @return Void |
786
|
|
|
*/ |
787
|
|
|
public function setPciDevices($pciDevices) |
788
|
|
|
{ |
789
|
|
|
array_push($this->_pciDevices, $pciDevices); |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* Returns $_ideDevices. |
794
|
|
|
* |
795
|
|
|
* @see System::$_ideDevices |
796
|
|
|
* |
797
|
|
|
* @return Array |
798
|
|
|
*/ |
799
|
|
|
public function getIdeDevices() |
800
|
|
|
{ |
801
|
|
|
return $this->_ideDevices; |
802
|
|
|
} |
803
|
|
|
|
804
|
|
|
/** |
805
|
|
|
* Sets $_ideDevices. |
806
|
|
|
* |
807
|
|
|
* @param HWDevice $ideDevices ide device |
808
|
|
|
* |
809
|
|
|
* @see System::$_ideDevices |
810
|
|
|
* @see HWDevice |
811
|
|
|
* |
812
|
|
|
* @return Void |
813
|
|
|
*/ |
814
|
|
|
public function setIdeDevices($ideDevices) |
815
|
|
|
{ |
816
|
|
|
array_push($this->_ideDevices, $ideDevices); |
817
|
|
|
} |
818
|
|
|
|
819
|
|
|
/** |
820
|
|
|
* Returns $_scsiDevices. |
821
|
|
|
* |
822
|
|
|
* @see System::$_scsiDevices |
823
|
|
|
* |
824
|
|
|
* @return Array |
825
|
|
|
*/ |
826
|
|
|
public function getScsiDevices() |
827
|
|
|
{ |
828
|
|
|
return $this->_scsiDevices; |
829
|
|
|
} |
830
|
|
|
|
831
|
|
|
/** |
832
|
|
|
* Sets $_scsiDevices. |
833
|
|
|
* |
834
|
|
|
* @param HWDevice $scsiDevices scsi devices |
835
|
|
|
* |
836
|
|
|
* @see System::$_scsiDevices |
837
|
|
|
* @see HWDevice |
838
|
|
|
* |
839
|
|
|
* @return Void |
840
|
|
|
*/ |
841
|
|
|
public function setScsiDevices($scsiDevices) |
842
|
|
|
{ |
843
|
|
|
array_push($this->_scsiDevices, $scsiDevices); |
844
|
|
|
} |
845
|
|
|
|
846
|
|
|
/** |
847
|
|
|
* Returns $_usbDevices. |
848
|
|
|
* |
849
|
|
|
* @see System::$_usbDevices |
850
|
|
|
* |
851
|
|
|
* @return Array |
852
|
|
|
*/ |
853
|
|
|
public function getUsbDevices() |
854
|
|
|
{ |
855
|
|
|
return $this->_usbDevices; |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
/** |
859
|
|
|
* Sets $_usbDevices. |
860
|
|
|
* |
861
|
|
|
* @param HWDevice $usbDevices usb device |
862
|
|
|
* |
863
|
|
|
* @see System::$_usbDevices |
864
|
|
|
* @see HWDevice |
865
|
|
|
* |
866
|
|
|
* @return Void |
867
|
|
|
*/ |
868
|
|
|
public function setUsbDevices($usbDevices) |
869
|
|
|
{ |
870
|
|
|
array_push($this->_usbDevices, $usbDevices); |
871
|
|
|
} |
872
|
|
|
|
873
|
|
|
/** |
874
|
|
|
* Returns $_tbDevices. |
875
|
|
|
* |
876
|
|
|
* @see System::$_tbDevices |
877
|
|
|
* |
878
|
|
|
* @return Array |
879
|
|
|
*/ |
880
|
|
|
public function getTbDevices() |
881
|
|
|
{ |
882
|
|
|
return $this->_tbDevices; |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
/** |
886
|
|
|
* Sets $_tbDevices. |
887
|
|
|
* |
888
|
|
|
* @param HWDevice $tbDevices thunderbolt device |
889
|
|
|
* |
890
|
|
|
* @see System::$_tbDevices |
891
|
|
|
* @see HWDevice |
892
|
|
|
* |
893
|
|
|
* @return Void |
894
|
|
|
*/ |
895
|
|
|
public function setTbDevices($tbDevices) |
896
|
|
|
{ |
897
|
|
|
array_push($this->_tbDevices, $tbDevices); |
898
|
|
|
} |
899
|
|
|
|
900
|
|
|
/** |
901
|
|
|
* Returns $_i2cDevices. |
902
|
|
|
* |
903
|
|
|
* @see System::$_i2cDevices |
904
|
|
|
* |
905
|
|
|
* @return Array |
906
|
|
|
*/ |
907
|
|
|
public function getI2cDevices() |
908
|
|
|
{ |
909
|
|
|
return $this->_i2cDevices; |
910
|
|
|
} |
911
|
|
|
|
912
|
|
|
/** |
913
|
|
|
* Sets $_i2cDevices. |
914
|
|
|
* |
915
|
|
|
* @param HWDevice $i2cDevices I2C device |
916
|
|
|
* |
917
|
|
|
* @see System::$_i2cDevices |
918
|
|
|
* @see HWDevice |
919
|
|
|
* |
920
|
|
|
* @return Void |
921
|
|
|
*/ |
922
|
|
|
public function setI2cDevices($i2cDevices) |
923
|
|
|
{ |
924
|
|
|
array_push($this->_i2cDevices, $i2cDevices); |
925
|
|
|
} |
926
|
|
|
|
927
|
|
|
/** |
928
|
|
|
* Returns $_diskDevices. |
929
|
|
|
* |
930
|
|
|
* @see System::$_diskDevices |
931
|
|
|
* |
932
|
|
|
* @return Array |
933
|
|
|
*/ |
934
|
|
|
public function getDiskDevices() |
935
|
|
|
{ |
936
|
|
|
return $this->_diskDevices; |
937
|
|
|
} |
938
|
|
|
|
939
|
|
|
/** |
940
|
|
|
* Sets $_diskDevices. |
941
|
|
|
* |
942
|
|
|
* @param DiskDevice $diskDevices disk device |
943
|
|
|
* |
944
|
|
|
* @see System::$_diskDevices |
945
|
|
|
* @see DiskDevice |
946
|
|
|
* |
947
|
|
|
* @return void |
948
|
|
|
*/ |
949
|
|
|
public function setDiskDevices($diskDevices) |
950
|
|
|
{ |
951
|
|
|
array_push($this->_diskDevices, $diskDevices); |
952
|
|
|
} |
953
|
|
|
|
954
|
|
|
/** |
955
|
|
|
* Returns $_memApplication. |
956
|
|
|
* |
957
|
|
|
* @see System::$_memApplication |
958
|
|
|
* |
959
|
|
|
* @return Integer |
960
|
|
|
*/ |
961
|
|
|
public function getMemApplication() |
962
|
|
|
{ |
963
|
|
|
return $this->_memApplication; |
964
|
|
|
} |
965
|
|
|
|
966
|
|
|
/** |
967
|
|
|
* Sets $_memApplication. |
968
|
|
|
* |
969
|
|
|
* @param Integer $memApplication application memory |
970
|
|
|
* |
971
|
|
|
* @see System::$_memApplication |
972
|
|
|
* |
973
|
|
|
* @return Void |
974
|
|
|
*/ |
975
|
|
|
public function setMemApplication($memApplication) |
976
|
|
|
{ |
977
|
|
|
$this->_memApplication = $memApplication; |
978
|
|
|
} |
979
|
|
|
|
980
|
|
|
/** |
981
|
|
|
* Returns $_memBuffer. |
982
|
|
|
* |
983
|
|
|
* @see System::$_memBuffer |
984
|
|
|
* |
985
|
|
|
* @return Integer |
986
|
|
|
*/ |
987
|
|
|
public function getMemBuffer() |
988
|
|
|
{ |
989
|
|
|
return $this->_memBuffer; |
990
|
|
|
} |
991
|
|
|
|
992
|
|
|
/** |
993
|
|
|
* Sets $_memBuffer. |
994
|
|
|
* |
995
|
|
|
* @param Integer $memBuffer buffer memory |
996
|
|
|
* |
997
|
|
|
* @see System::$_memBuffer |
998
|
|
|
* |
999
|
|
|
* @return Void |
1000
|
|
|
*/ |
1001
|
|
|
public function setMemBuffer($memBuffer) |
1002
|
|
|
{ |
1003
|
|
|
$this->_memBuffer = $memBuffer; |
1004
|
|
|
} |
1005
|
|
|
|
1006
|
|
|
/** |
1007
|
|
|
* Returns $_memCache. |
1008
|
|
|
* |
1009
|
|
|
* @see System::$_memCache |
1010
|
|
|
* |
1011
|
|
|
* @return Integer |
1012
|
|
|
*/ |
1013
|
|
|
public function getMemCache() |
1014
|
|
|
{ |
1015
|
|
|
return $this->_memCache; |
1016
|
|
|
} |
1017
|
|
|
|
1018
|
|
|
/** |
1019
|
|
|
* Sets $_memCache. |
1020
|
|
|
* |
1021
|
|
|
* @param Integer $memCache cache memory |
1022
|
|
|
* |
1023
|
|
|
* @see System::$_memCache |
1024
|
|
|
* |
1025
|
|
|
* @return Void |
1026
|
|
|
*/ |
1027
|
|
|
public function setMemCache($memCache) |
1028
|
|
|
{ |
1029
|
|
|
$this->_memCache = $memCache; |
1030
|
|
|
} |
1031
|
|
|
|
1032
|
|
|
/** |
1033
|
|
|
* Returns $_memFree. |
1034
|
|
|
* |
1035
|
|
|
* @see System::$_memFree |
1036
|
|
|
* |
1037
|
|
|
* @return Integer |
1038
|
|
|
*/ |
1039
|
|
|
public function getMemFree() |
1040
|
|
|
{ |
1041
|
|
|
return $this->_memFree; |
1042
|
|
|
} |
1043
|
|
|
|
1044
|
|
|
/** |
1045
|
|
|
* Sets $_memFree. |
1046
|
|
|
* |
1047
|
|
|
* @param Integer $memFree free memory |
1048
|
|
|
* |
1049
|
|
|
* @see System::$_memFree |
1050
|
|
|
* |
1051
|
|
|
* @return Void |
1052
|
|
|
*/ |
1053
|
|
|
public function setMemFree($memFree) |
1054
|
|
|
{ |
1055
|
|
|
$this->_memFree = $memFree; |
1056
|
|
|
} |
1057
|
|
|
|
1058
|
|
|
/** |
1059
|
|
|
* Returns $_memTotal. |
1060
|
|
|
* |
1061
|
|
|
* @see System::$_memTotal |
1062
|
|
|
* |
1063
|
|
|
* @return Integer |
1064
|
|
|
*/ |
1065
|
|
|
public function getMemTotal() |
1066
|
|
|
{ |
1067
|
|
|
return $this->_memTotal; |
1068
|
|
|
} |
1069
|
|
|
|
1070
|
|
|
/** |
1071
|
|
|
* Sets $_memTotal. |
1072
|
|
|
* |
1073
|
|
|
* @param Integer $memTotal total memory |
1074
|
|
|
* |
1075
|
|
|
* @see System::$_memTotal |
1076
|
|
|
* |
1077
|
|
|
* @return Void |
1078
|
|
|
*/ |
1079
|
|
|
public function setMemTotal($memTotal) |
1080
|
|
|
{ |
1081
|
|
|
$this->_memTotal = $memTotal; |
1082
|
|
|
} |
1083
|
|
|
|
1084
|
|
|
/** |
1085
|
|
|
* Returns $_memUsed. |
1086
|
|
|
* |
1087
|
|
|
* @see System::$_memUsed |
1088
|
|
|
* |
1089
|
|
|
* @return Integer |
1090
|
|
|
*/ |
1091
|
|
|
public function getMemUsed() |
1092
|
|
|
{ |
1093
|
|
|
return $this->_memUsed; |
1094
|
|
|
} |
1095
|
|
|
|
1096
|
|
|
/** |
1097
|
|
|
* Sets $_memUsed. |
1098
|
|
|
* |
1099
|
|
|
* @param Integer $memUsed used memory |
1100
|
|
|
* |
1101
|
|
|
* @see System::$_memUsed |
1102
|
|
|
* |
1103
|
|
|
* @return Void |
1104
|
|
|
*/ |
1105
|
|
|
public function setMemUsed($memUsed) |
1106
|
|
|
{ |
1107
|
|
|
$this->_memUsed = $memUsed; |
1108
|
|
|
} |
1109
|
|
|
|
1110
|
|
|
/** |
1111
|
|
|
* Returns $_swapDevices. |
1112
|
|
|
* |
1113
|
|
|
* @see System::$_swapDevices |
1114
|
|
|
* |
1115
|
|
|
* @return Array |
1116
|
|
|
*/ |
1117
|
|
|
public function getSwapDevices() |
1118
|
|
|
{ |
1119
|
|
|
return $this->_swapDevices; |
1120
|
|
|
} |
1121
|
|
|
|
1122
|
|
|
/** |
1123
|
|
|
* Sets $_swapDevices. |
1124
|
|
|
* |
1125
|
|
|
* @param DiskDevice $swapDevices swap devices |
1126
|
|
|
* |
1127
|
|
|
* @see System::$_swapDevices |
1128
|
|
|
* @see DiskDevice |
1129
|
|
|
* |
1130
|
|
|
* @return Void |
1131
|
|
|
*/ |
1132
|
|
|
public function setSwapDevices($swapDevices) |
1133
|
|
|
{ |
1134
|
|
|
array_push($this->_swapDevices, $swapDevices); |
1135
|
|
|
} |
1136
|
|
|
|
1137
|
|
|
/** |
1138
|
|
|
* Returns $_processes. |
1139
|
|
|
* |
1140
|
|
|
* @see System::$_processes |
1141
|
|
|
* |
1142
|
|
|
* @return Array |
1143
|
|
|
*/ |
1144
|
|
|
public function getProcesses() |
1145
|
|
|
{ |
1146
|
|
|
return $this->_processes; |
1147
|
|
|
} |
1148
|
|
|
|
1149
|
|
|
/** |
1150
|
|
|
* Sets $_proceses. |
1151
|
|
|
* |
1152
|
|
|
* @param $processes array of types of processes |
1153
|
|
|
* |
1154
|
|
|
* @see System::$_processes |
1155
|
|
|
* |
1156
|
|
|
* @return Void |
1157
|
|
|
*/ |
1158
|
|
|
public function setProcesses($processes) |
1159
|
|
|
{ |
1160
|
|
|
$this->_processes = $processes; |
1161
|
|
|
/* |
|
|
|
|
1162
|
|
|
foreach ($processes as $proc_type=>$proc_count) { |
1163
|
|
|
$this->_processes[$proc_type] = $proc_count; |
1164
|
|
|
} |
1165
|
|
|
*/ |
1166
|
|
|
} |
1167
|
|
|
} |
1168
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.