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