1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | $ smtctl This system is SMT capable. SMT is currently enabled. SMT boot mode is not set. SMT threads are bound to the same physical processor. proc0 has 2 SMT threads. Bind processor 0 is bound with proc0 Bind processor 1 is bound with proc0 proc2 has 2 SMT threads. Bind processor 2 is bound with proc2 Bind processor 3 is bound with proc2 proc4 has 2 SMT threads. Bind processor 4 is bound with proc4 Bind processor 5 is bound with proc4 proc6 has 2 SMT threads. Bind processor 6 is bound with proc6 Bind processor 7 is bound with proc6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | my $output = `smtctl`; # 如果 SMT 技术没有被激活,通常我们需要激活它 if ($output =~ m/This system is SMT capable.*SMT is currently disabled/) { warn "This system can have SMT enabled, but has not. This means potential performance issue in some applications. Command smtctl can be used to enable SMT. Notice that change can NOT be directly done on workload partition.\n"; } # 解析文本文件 /tmp/mpstat_output。用户应该先运行 mpstat 并把输出重定向来得到这个文件。 my $file = '/tmp/mpstat_output'; open (FILE, "<$file") or die "No mpstat output file available. Please run mpstat first.\n"; my @output = <FILE>; close FILE; my @notice; foreach my $line (@output) { chomp $line; # 跳过空行和提示行 if ($line !~ /\S+/) {next;} if ($line =~ m/System configuration/ || $line =~/cpu\s+min/) {next;} # 删除每行起始的空格 $line =~ s/^\s+//g; my ($cpu, $min, $maj, $mpc, $int, $cs, $ics, $rq, $mig, $lpa, $sysc, $us, $sy, $wt, $id, $pc); = split /\s+/, $line; # 通常系统中不应有过长的运行队列,过多的线程迁移,过长的等待时间或过少的空闲时间 if ($rq > 5 || $mig > 5 || $wt > 5 || $id < 10) { push @notice, $line; } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |