Get System Info in Windows Env
by Perl
#!/usr/bin/perl
use strict;
use warnings;
use Win32::SystemInfo;
my %phash;
Win32::SystemInfo::ProcessorInfo(%phash);
for (my $i = 0; $i < $phash{NumProcessors}; $i++) {
print "Speed of processor $i: " . $phash{"Processor$i"}{MHZ} . "MHz\n";
}
my %mHash;
Win32::SystemInfo::MemoryStatus(%mHash,"KB");
print "MemLoad : " . $mHash{MemLoad} . " %\n";
print "AvailPhys : " . $mHash{AvailPhys} . " Kbytes\n";
print "TotalPage : " . $mHash{TotalPage} . " Kbytes\n";
print "AvailPage : " . $mHash{TotalPage} . " Kbytes\n";
print "TotalVirtual : " . $mHash{TotalVirtual} . " Kbytes\n";
print "AvailVirtual : " . $mHash{AvailVirtual} . " Kbytes\n";
결과는
C:\Documents and Settings\johlim>perl a.pl
Speed of processor 0: 1697MHz
MemLoad : 54 %
AvailPhys : 481080 Kbytes
TotalPage : 2521020 Kbytes
AvailPage : 2521020 Kbytes
TotalVirtual : 2097024 Kbytes
AvailVirtual : 2056508 Kbytes
C:\Documents and Settings\johlim>
by Perl
#!/usr/bin/perl
use strict;
use warnings;
use Win32::SystemInfo;
my %phash;
Win32::SystemInfo::ProcessorInfo(%phash);
for (my $i = 0; $i < $phash{NumProcessors}; $i++) {
print "Speed of processor $i: " . $phash{"Processor$i"}{MHZ} . "MHz\n";
}
my %mHash;
Win32::SystemInfo::MemoryStatus(%mHash,"KB");
print "MemLoad : " . $mHash{MemLoad} . " %\n";
print "AvailPhys : " . $mHash{AvailPhys} . " Kbytes\n";
print "TotalPage : " . $mHash{TotalPage} . " Kbytes\n";
print "AvailPage : " . $mHash{TotalPage} . " Kbytes\n";
print "TotalVirtual : " . $mHash{TotalVirtual} . " Kbytes\n";
print "AvailVirtual : " . $mHash{AvailVirtual} . " Kbytes\n";
결과는
C:\Documents and Settings\johlim>perl a.pl
Speed of processor 0: 1697MHz
MemLoad : 54 %
AvailPhys : 481080 Kbytes
TotalPage : 2521020 Kbytes
AvailPage : 2521020 Kbytes
TotalVirtual : 2097024 Kbytes
AvailVirtual : 2056508 Kbytes
C:\Documents and Settings\johlim>
댓글