Subversion Repositories ALCASAR

Rev

Rev 2976 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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