perl 验证vmstat si so默认单位为KB

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0 972948   7284    124   1608 5504 138308  8404 138308 77635 1301 31 31 34  5  0	
 3  0 918228   4724    124   1440 5580 114584  7892 114584 51221 1233 30 28 32 10  0	
 4  0 911040   4972    124   1408 5608 160220  6904 160220 85565 1354 31 33 34  2  0	
 2  0 899508  59768    260   3996 6368 152420 10588 152420 39599 1229 30 23 36 11  0	
 2  0 899688 124636    152   2400 5472 163372  6772 163372 78503 1171 30 32 34  4  0	
 2  0 899976 270416    132   2636 5360 168672  6468 168672 87942 1332 30 35 32  3  0	
 2  0 900016 360608    132   3092 5568 165984  9332 165984 82205 1551 30 33 33  4  0	

单位KB: 转换为MB是160M左右,vmstat si so默认单位是KB。






procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0    953      5      0      1    5  167  7836 163424 58563 1295 31 29 36  4  0	
 4  0    937      5      0      1    6  153  7328 149444 70055 1239 31 31 32  6  0	
 2  1    922      5      0      1    4  151  5424 148156 69282  978 31 32 35  3  0	
 2  0    921    417      0      3    7  167 13244 163600 75972 1815 28 34 19 19  0	
 2  0   1090    163      0      1    4  170  6236 166068 91665 1070 31 34 31  5  0	
 2  1   1082      5      0      1    1  161  3668 157568 76195  890 31 32 33  5  0	
 3  1   1065      5      0      1    5  152  7816 148580 79105 1217 31 33 32  5  0	
 3  0   1035      5      0      1    6  137  9232 134352 66471 1166 30 31 35  3  0	
 3  0   1016      5      0      1    4  150  7000 147180 80158 1200 31 32 35  2  0	
 3  0    999      4      0      1    6  155  8772 152204 73963 1445 31 32 34  4  0	


模拟程序:

while (1==1){
open FILE, "<file";
my $content;
{
    local $/ = undef;
    $content = <FILE>;
}
my $i = 1;
my %hash;
while($i < 500){
    $hash{$i} = $content. $i;
    $i++;
}

}

原文地址:https://www.cnblogs.com/hzcya1995/p/13351393.html