新石器Wiki

近年はシリコン(石)から進化した便利なもので溢れる時代。そんな気になった事や試した事など記す。

ユーザ用ツール

サイト用ツール


programing:linux-programing:linux-cpu-core-shield


差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
programing:linux-programing:linux-cpu-core-shield [2022/10/21 14:34] – [参考] yokoprograming:linux-programing:linux-cpu-core-shield [2022/10/25 13:09] (現在) – [CPU Affinityの一覧表示] yoko
行 73: 行 73:
 <code bash> <code bash>
 $ cat /proc/interrupts $ cat /proc/interrupts
 +            CPU0       CPU1       CPU2       CPU3
 +   0:         17          0          0          0  IR-IO-APIC    2-edge      timer
 +   6:          0          0          0          1  IR-IO-APIC    6-edge      ttyS2
 +   8:          0          0          1          0  IR-IO-APIC    8-edge      rtc0
 +   9:          0          5          0          0  IR-IO-APIC    9-fasteoi   acpi
 + ...
 </code> </code>
  
行 143: 行 149:
 $ sudo ./irq_shield.pl enp1s0 set $ sudo ./irq_shield.pl enp1s0 set
 </code> </code>
 +
 +
 +その他
 +-----
 +
 +### CPUに負荷をかける
 +stressコマンドで、CPUのコア#2に演算負荷をかける。
 +
 +<code bash>
 +$ taskset -c 2 stress -c 1
 +</code>
 +
 +### CPU負荷状況の確認
 +下記コマンドでCPUの負荷状況を表示。
 +
 +<code bash>
 +$ dstat -c -C 0,1,2,3
 +-----cpu0-usage----------cpu1-usage----------cpu2-usage----------cpu3-usage----
 +usr sys idl wai stl:usr sys idl wai stl:usr sys idl wai stl:usr sys idl wai stl
 +  5    91     0:  7    90     0: 17    83     0:  0   0 100     0
 + 11    83     0:  9    91     0: 99         0:  1    98     0
 + 11    85     0:  8    92     0: 98         0:  0    99     0
 +  9    86     0:  5    95     0: 99         0:  1    98     0
 +  9    84     0:  8    91     0: 99         0:  0    98     0
 + 14    81     0:  7    93     0:100         0:  0    99     0
 + 12    83     0:  8    92     0: 99         0:  0    99     0
 +  9    86     0:  4    95     0: 99         0:  0    98     0
 + 14    80     0:  5    95     0: 98         0:  2    98     0
 + 10    85     0:  6    94     0:100         0:  0    99     0
 + 10    83     0:  4    96     0:100         0:  0   0 100     0
 +</code>
 +### CPU Affinityの一覧表示
 +全プロセスのCPU Affinityを一覧表示するPerlスクリプト。
 +
 +<code perl cpu_pslist.pl>
 +#!/usr/bin/perl
 +#
 +# CPU affinityの一覧を表示する。
 +#
 +
 +use strict;
 +use warnings;
 +
 +my @result;
 +my $mode = 0;
 +
 +if (@ARGV >= 1) {
 +    if ($ARGV[0] eq "tree") {
 + $mode = 1;
 +    }
 +}
 +
 +if ($mode == 0) {
 +    @result = `ps aux`;
 +}
 +else {
 +    @result = `ps auxf`;
 +}
 +
 +foreach my $line(@result)
 +{
 +    my @a = split(/\s+/, $line); # 複数の空白や改行でで分割
 +
 +    if ($a[1] eq "PID") {
 + print "AFFIN " . $line;
 +    }
 +    else {
 + my $affi = `taskset -pc $a[1] 2>&1`; # エラー出力は標準へ
 + if ($? == 0) { # コマンド実行のリターンコード
 +     my @b = split(/\s+/, $affi); # 複数の空白や改行で分割
 +     my $str = sprintf("%-6s", $b[$#b]); # CPU affinity
 +     print $str . $line;
 + }
 +    }
 +}
 +</code>
 +
  
 参考 参考
行 161: 行 244:
 13. [[https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/assembly_configuring-cpu-affinity-and-numa-policies-using-systemd_managing-monitoring-and-updating-the-kernel|第28章 systemd を使用した CPU のアフィニティーおよび NUMA ポリシーの設定]] 13. [[https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/assembly_configuring-cpu-affinity-and-numa-policies-using-systemd_managing-monitoring-and-updating-the-kernel|第28章 systemd を使用した CPU のアフィニティーおよび NUMA ポリシーの設定]]
 14. [[https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-tuning_scheduling_policy-isolating_cpus|6.3.6.2. CPU の分離]] 14. [[https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-tuning_scheduling_policy-isolating_cpus|6.3.6.2. CPU の分離]]
-15. [[https://blog.amedama.jp/entry/stress-commandstress コマンドを使ってマシンに負荷をかける]]+15. [[https://blog.amedama.jp/entry/stress-command|stress コマンドを使ってマシンに負荷をかける]]
 16. {{https://www.concurrent-rt.co.jp/external/TechSup/PDF/RedHawkLinux_UsersGuide8.2_Jpn.pdf}} 16. {{https://www.concurrent-rt.co.jp/external/TechSup/PDF/RedHawkLinux_UsersGuide8.2_Jpn.pdf}}
  
  
  
programing/linux-programing/linux-cpu-core-shield.1666330442.txt.gz · 最終更新: 2022/10/21 14:34 by yoko