@Gugoole
2018-12-10T14:22:05.000000Z
字数 14926
阅读 6020
linux 学习笔记
ps命令看到的处于R状态的进程 ps命令看到的D状态的进程1分钟、5分钟、15分钟负载基本相同,说明系统负载平稳1分钟平均负载接近或超过CPU个数,意味着系统正在发生过载问题uptime:当前时间、系统运行时间、正在登录用户数、过去1分钟、5分钟、15分钟的平均负载
➜ ~ uptime22:04:25 up 3:53, 1 user, load average: 0.19, 0.18, 0.18
iostat
➜ ~ iostatLinux 4.15.0-29deepin-generic (gugoole-PC) 2018年11月29日 _x86_64_ (8 CPU)avg-cpu: %user %nice %system %iowait %steal %idle2.37 0.01 0.79 0.33 0.00 96.51Device tps kB_read/s kB_wrtn/s kB_read kB_wrtnnvme1n1 812.83 177.01 389.51 3074554 6765817nvme0n1 0.03 1.43 0.00 24759 0
mpstat
# 每隔5秒输出1组数据➜ ~ mpstat -P ALL 5 1Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年11月29日 _x86_64_ (8 CPU)23时03分07秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle23时03分12秒 all 1.56 0.00 0.98 0.13 0.00 0.00 0.00 0.00 0.00 97.3323时03分12秒 0 1.60 0.00 0.80 0.00 0.00 0.00 0.00 0.00 0.00 97.6023时03分12秒 1 2.02 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00 97.3823时03分12秒 2 2.41 0.00 2.01 0.00 0.00 0.00 0.00 0.00 0.00 95.5723时03分12秒 3 1.80 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 97.2023时03分12秒 4 0.80 0.00 1.61 1.00 0.00 0.00 0.00 0.00 0.00 96.5923时03分12秒 5 1.61 0.00 1.01 0.00 0.00 0.00 0.00 0.00 0.00 97.3823时03分12秒 6 0.81 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00 98.5923时03分12秒 7 1.42 0.00 0.20 0.00 0.00 0.00 0.00 0.00 0.00 98.37平均时间: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle平均时间: all 1.56 0.00 0.98 0.13 0.00 0.00 0.00 0.00 0.00 97.33平均时间: 0 1.60 0.00 0.80 0.00 0.00 0.00 0.00 0.00 0.00 97.60平均时间: 1 2.02 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00 97.38平均时间: 2 2.41 0.00 2.01 0.00 0.00 0.00 0.00 0.00 0.00 95.57平均时间: 3 1.80 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 97.20平均时间: 4 0.80 0.00 1.61 1.00 0.00 0.00 0.00 0.00 0.00 96.59平均时间: 5 1.61 0.00 1.01 0.00 0.00 0.00 0.00 0.00 0.00 97.38平均时间: 6 0.81 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00 98.59平均时间: 7 1.42 0.00 0.20 0.00 0.00 0.00 0.00 0.00 0.00 98.37
piastat
# 每隔5秒显示1次CPU的使用统计➜ ~ pidstat -u 5 1Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年11月29日 _x86_64_ (8 CPU)23时03分59秒 UID PID %usr %system %guest %wait %CPU CPU Command23时04分04秒 0 2737 0.00 0.20 0.00 0.00 0.20 1 NetworkManager23时04分04秒 0 2741 0.20 0.00 0.00 0.00 0.20 0 dde-system-daem23时04分04秒 1000 2813 2.99 1.60 0.00 0.00 4.59 7 netease-cloud-m23时04分04秒 1000 2886 0.60 0.00 0.00 0.00 0.60 7 netease-cloud-m23时04分04秒 0 3634 2.79 0.20 0.00 0.20 2.99 5 Xorg23时04分04秒 0 3793 0.00 0.40 0.00 0.20 0.40 4 irq/150-nvidia23时04分04秒 1000 4971 3.99 1.80 0.00 0.00 5.79 3 deepin-wm23时04分04秒 1000 5020 0.20 0.00 0.00 0.00 0.20 6 dde-session-dae23时04分04秒 1000 5053 0.00 0.20 0.00 0.00 0.20 3 dde-desktop23时04分04秒 1000 8346 0.20 0.60 0.00 0.00 0.80 4 pulseaudio23时04分04秒 1000 8732 0.20 0.00 0.00 0.00 0.20 7 deepin-cloud-pr23时04分04秒 1000 13557 1.00 3.39 0.00 0.00 4.39 1 wineserver.real23时04分04秒 1000 13599 0.00 0.20 0.00 0.00 0.20 7 QQProtect.exe23时04分04秒 1000 13753 2.59 4.79 0.00 0.20 7.39 6 TIM.exe23时04分04秒 1000 16999 0.00 0.20 0.00 0.00 0.20 5 WeChat.exe23时04分04秒 1000 17004 0.20 0.00 0.00 0.00 0.20 3 wineserver.real23时04分04秒 1000 24626 0.20 0.00 0.00 0.00 0.20 3 java23时04分04秒 1000 32107 0.20 0.00 0.00 0.00 0.20 0 cmd-markdown23时04分04秒 1000 32314 1.20 0.20 0.00 0.00 1.40 2 deepin-terminal平均时间: UID PID %usr %system %guest %wait %CPU CPU Command平均时间: 0 2737 0.00 0.20 0.00 0.00 0.20 - NetworkManager平均时间: 0 2741 0.20 0.00 0.00 0.00 0.20 - dde-system-daem平均时间: 1000 2813 2.99 1.60 0.00 0.00 4.59 - netease-cloud-m平均时间: 1000 2886 0.60 0.00 0.00 0.00 0.60 - netease-cloud-m平均时间: 0 3634 2.79 0.20 0.00 0.20 2.99 - Xorg平均时间: 0 3793 0.00 0.40 0.00 0.20 0.40 - irq/150-nvidia平均时间: 1000 4971 3.99 1.80 0.00 0.00 5.79 - deepin-wm平均时间: 1000 5020 0.20 0.00 0.00 0.00 0.20 - dde-session-dae平均时间: 1000 5053 0.00 0.20 0.00 0.00 0.20 - dde-desktop平均时间: 1000 8346 0.20 0.60 0.00 0.00 0.80 - pulseaudio平均时间: 1000 8732 0.20 0.00 0.00 0.00 0.20 - deepin-cloud-pr平均时间: 1000 13557 1.00 3.39 0.00 0.00 4.39 - wineserver.real平均时间: 1000 13599 0.00 0.20 0.00 0.00 0.20 - QQProtect.exe平均时间: 1000 13753 2.59 4.79 0.00 0.20 7.39 - TIM.exe平均时间: 1000 16999 0.00 0.20 0.00 0.00 0.20 - WeChat.exe平均时间: 1000 17004 0.20 0.00 0.00 0.00 0.20 - wineserver.real平均时间: 1000 24626 0.20 0.00 0.00 0.00 0.20 - java平均时间: 1000 32107 0.20 0.00 0.00 0.00 0.20 - cmd-markdown
sleep这样的方法将自己主动挂起,也会重新调度vmstat cs(context switch) 表示每秒上下文切换的次数in(interrupt)表示每秒中断次数r(Running or Runnable)表示就绪队列的长度,也就是正在运行和等待CPU的进程数b(Blocked)表示处于不可中断睡眠状态的进程数
#每隔5秒输出一组数据➜ ~ vmstat -w 5procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r b swpd free buff cache si so bi bo in cs us sy id wa st0 0 0 12823272 108404 1917160 0 0 0 2 264 756 0 0 99 0 00 0 0 12823024 108404 1917160 0 0 0 2 275 835 0 0 100 0 00 0 0 12823148 108408 1917160 0 0 0 1 262 775 0 0 99 0 00 0 0 12821596 108408 1917192 0 0 0 0 347 921 0 0 99 0 00 0 0 12821820 108416 1917192 0 0 0 63 259 732 0 0 99 0 00 0 0 12821436 108424 1917184 0 0 0 2 263 735 0 0 100 0 00 0 0 12821596 108424 1917192 0 0 0 1 267 767 0 0 100 0 00 0 0 12821720 108424 1917192 0 0 0 0 256 752 0 0 100 0 00 0 0 12822500 108424 1917192 0 0 0 0 250 714 0 0 100 0 00 0 0 12822088 108424 1917196 0 0 0 0 266 755 0 0 100 0 00 0 0 12822088 108432 1917196 0 0 0 11 256 760 0 0 100 0 00 0 0 12822336 108432 1917196 0 0 0 0 251 750 0 0 100 0 00 0 0 12822112 108432 1917196 0 0 0 0 249 742 0 0 100 0 03 0 0 12822460 108432 1917196 0 0 0 0 493 3035 1 0 99 0 00 0 0 12822296 108432 1917196 0 0 0 0 282 959 0 0 99 0 00 0 0 12822800 108432 1917196 0 0 0 0 333 1301 1 0 99 0 00 0 0 12822988 108448 1917260 0 0 0 33 367 1488 1 0 99 0 00 0 0 12822208 108496 1917388 0 0 0 66 571 3434 2 1 97 0 00 0 0 12821180 108544 1917516 0 0 0 70 474 2863 2 0 98 0 00 0 0 12820256 108576 1917712 0 0 0 51 491 2601 1 0 98 0 00 0 0 12825024 108640 1915424 0 0 0 230 452 2502 1 0 98 0 00 1 0 12824240 108700 1915560 0 0 0 86 611 4187 2 0 97 0 00 0 0 12824932 108740 1915588 0 0 0 222 378 1669 1 0 99 0 00 0 0 12824784 108764 1915652 0 0 0 29 337 1440 1 0 99 0 00 0 0 12824848 108780 1915676 0 0 0 27 264 773 0 0 99 0 00 0 0 12824536 108788 1915684 0 0 0 12 265 814 0 0 99 0 00 0 0 12824760 108788 1915684 0 0 0 1 257 762 0 0 100 0 00 0 0 12824248 108788 1915684 0 0 0 0 286 1029 0 0 100 0 00 0 0 12823608 108812 1915680 0 0 0 36 991 20344 3 1 96 0 00 0 0 12823620 108832 1915660 0 0 0 23 319 1154 0 0 99 0 04 0 0 12822932 108840 1915680 0 0 0 6 380 2255 1 0 99 0 00 0 0 12823044 108848 1915680 0 0 0 8 1049 18649 4 1 96 0 00 0 0 12823188 108848 1915680 0 0 0 5 409 2391 1 0 99 0 00 0 0 12823044 108848 1915680 0 0 0 0 407 1636 0 0 99 0 0
pidstat cswch表示每秒自愿上下文切换的次数nvcswch 表示每秒非自愿上下文切换的次数
#每隔5秒输出一组数据➜ ~ pidstat -w 5Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年11月30日 _x86_64_ (8 CPU)11时25分41秒 UID PID cswch/s nvcswch/s Command11时25分46秒 0 8 6.59 0.00 rcu_sched11时25分46秒 0 11 0.20 0.00 watchdog/011时25分46秒 0 14 0.20 0.00 watchdog/111时25分46秒 0 20 0.20 0.00 watchdog/211时25分46秒 0 26 0.20 0.00 watchdog/311时25分46秒 0 32 0.20 0.00 watchdog/411时25分46秒 0 38 0.20 0.00 watchdog/511时25分46秒 0 44 0.20 0.00 watchdog/611时25分46秒 0 50 0.20 0.00 watchdog/711时25分46秒 0 219 0.40 0.00 kworker/u16:211时25分46秒 0 456 0.40 0.00 kworker/0:1H11时25分46秒 0 668 1.20 0.00 irq/148-iwlwifi11时25分46秒 0 1638 0.60 0.20 jbd2/nvme0n1p4-11时25分46秒 102 2784 3.79 0.00 dbus-daemon11时25分46秒 0 2796 2.20 0.00 NetworkManager11时25分46秒 0 2830 0.20 0.00 systemd-logind11时25分46秒 0 2831 0.20 0.00 acpid11时25分46秒 0 2865 1.00 0.00 vmware-usbarbit11时25分46秒 0 3191 0.20 0.00 dde-file-manage11时25分46秒 0 3375 85.63 0.20 Xorg11时25分46秒 0 3546 8.58 0.00 irq/150-nvidia11时25分46秒 0 4658 1.00 0.00 vmware-authdlau11时25分46秒 1000 4894 1.40 0.00 dbus-daemon
/proc/interrupts文件来分析具体的中断类型/proc/stat USER_HZ即10ms
➜ ~ cat /proc/stat|grep ^cpucpu 135307 6855 165552 1632799 2751 0 723 0 0 0cpu0 16158 843 20907 1406454 2371 0 533 0 0 0cpu1 16261 673 21406 32408 68 0 117 0 0 0cpu2 17232 888 20364 32294 52 0 41 0 0 0cpu3 16700 988 20565 32273 38 0 8 0 0 0cpu4 17055 1003 20636 32286 39 0 10 0 0 0cpu5 16702 832 20515 32345 54 0 5 0 0 0cpu6 17635 843 20566 32349 55 0 3 0 0 0cpu7 17561 782 20590 32388 71 0 3 0 0 0
top us:用户态CPU时间sy:内核态CPU时间ni:低优先级用户态CPU时间id:空闲时间wa:等待I/O的CPU时间hi:处理硬中断的CPU时间si:处理软中断的CPU时间st:当系统运行在虚拟机中的时候,被其他虚拟机占用的CPU时间
top - 12:55:59 up 4:19, 1 user, load average: 0.12, 0.09, 0.13Tasks: 247 total, 1 running, 246 sleeping, 0 stopped, 0 zombie%Cpu(s): 0.8 us, 0.3 sy, 0.0 ni, 98.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stMiB Mem : 15924.8 total, 11337.8 free, 2364.4 used, 2222.7 buff/cacheMiB Swap: 20480.0 total, 20480.0 free, 0.0 used. 13129.7 avail MemPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND3375 root 20 0 448948 143308 67488 S 4.7 0.9 3:03.23 Xorg5034 gugoole 20 0 1113836 301848 83808 S 2.0 1.9 1:36.60 deepin-wm12563 gugoole 20 0 639916 53484 38248 S 2.0 0.3 0:20.85 deepin-terminal12897 gugoole 20 0 781592 62376 51520 S 0.7 0.4 0:00.96 deepin-menu3546 root -51 0 0 0 0 S 0.3 0.0 0:25.21 irq/150-nvidia5078 gugoole 20 0 2929588 60320 40260 S 0.3 0.4 0:13.14 dde-session-dae5105 gugoole 20 0 1032992 91004 60048 S 0.3 0.6 0:06.08 dde-dock5112 gugoole 20 0 1191456 84600 69972 S 0.3 0.5 0:38.45 dde-desktop22085 root 20 0 0 0 0 I 0.3 0.0 0:00.40 kworker/1:022485 gugoole 20 0 796232 61444 51036 S 0.3 0.4 0:00.35 dde-osd1 root 20 0 225992 9876 6724 S 0.0 0.1 0:02.27 systemd2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq7 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0
pidstat %usr:用户态CPU使用率%system:内核态CPU使用率%guest:运行虚拟机CPU使用率%wait:等待CPU使用率%CPU:总的CPU使用率
➜ ~ pidstat 1 5Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年11月30日 _x86_64_ (8 CPU)13时36分14秒 UID PID %usr %system %guest %wait %CPU CPU Command13时36分15秒 0 8 0.00 0.99 0.00 0.00 0.99 5 rcu_sched13时36分15秒 0 3375 1.98 0.00 0.00 0.99 1.98 2 Xorg13时36分15秒 0 3546 0.00 0.99 0.00 0.00 0.99 1 irq/150-nvidia13时36分15秒 1000 4861 0.99 0.00 0.00 0.00 0.99 2 startdde13时36分15秒 1000 5034 0.99 0.00 0.00 0.00 0.99 7 deepin-wm13时36分15秒 1000 12563 0.99 0.00 0.00 0.00 0.99 4 deepin-terminal
perf top采样 Samples:采样数event:事件类型Event count:事件总数量Overhead:指该符号的性能事件在所有采用中的比例Shared:指该函数或指令所在的动态共享对象,如:内核、进程名、动态链接库名等Object:动态共享对象的类型 [.]表示用户空间的可执行程序、或者动态链接库[k]表示内核空间Symbol:表示符号名,即函数名,当函数未命名时用16进制地址表示
Samples: 2K of event 'cycles:ppp', Event count (approx.): 1330995812Overhead Shared Object Symbol9.20% [kernel] [k] module_get_kallsym3.96% [kernel] [k] vsnprintf2.73% [kernel] [k] format_decode2.73% perf [.] 0x00000000001ea3731.89% [kernel] [k] number1.88% [kernel] [k] kallsyms_expand_symbol.constprop.11.69% perf [.] 0x00000000001f63681.69% [kernel] [k] memcpy_erms1.43% perf [.] 0x00000000001f77d01.34% libc-2.27.so [.] __libc_calloc1.24% [kernel] [k] string
perf record perf report perf record保存的采样信息
Samples: 3K of event 'cycles:ppp', Event count (approx.): 1778811422Overhead Command Shared Object Symbol28.61% swapper [kernel.kallsyms] [k] intel_idle4.44% Xorg [kernel.kallsyms] [k] pci_conf1_read2.35% kworker/1:2 [kernel.kallsyms] [k] _nv029827rm2.05% Xorg [kernel.kallsyms] [k] _nv029827rm1.76% deepin-wm [kernel.kallsyms] [k] pci_conf1_read1.61% deepin-wm [kernel.kallsyms] [k] _nv029827rm1.09% irq/150-nvidia [kernel.kallsyms] [k] _nv029827rm1.08% deepin-wm [kernel.kallsyms] [k] syscall_return_via_sysret0.91% swapper [unknown] [k] 00000000000000000.71% Xorg [kernel.kallsyms] [k] _nv018294rm0.41% swapper [kernel.kallsyms] [k] update_load_avg0.33% Xorg [vdso] [.] 0x0000000000000977
-g参数以开启调用关系的采样
Samples: 36K of event 'cycles:ppp', Event count (approx.): 7290912532Children Self Shared Object Symbol- 15.23% 1.57% [unknown] [k] 0000000000000000- 7.58% 0+ 12.19% 0.14% [kernel] [k] entry_SYSCALL_64_after_hwframe- 12.01% 0.28% [kernel] [k] do_syscall_64- 3.03% do_syscall_64- 8.65% 0.16% [kernel] [k] do_idle- 1.75% do_idle+ 4.22% 0.02% [kernel] [k] call_cpuidle+ 4.09% 0.22% [kernel] [k] cpuidle_enter_state+ 4.01% 0.02% [kernel]
top命令 R:Running或Runnable的缩写,表示进程在CPU的就绪队列中,正在运行或者正在等待运行D:Disk Sleep的缩写,即不可中断状态睡眠,一般表示进程正在跟硬件交互,并且过程不允许被打断Z:Zombie的缩写,表示僵尸进程S:Interruptible Sleep的缩写,即可中断状态睡眠,表示进程由于等待某个进程而被系统挂起I:Idle的缩写,表示空闲状态,不会导致平均负载升高T或t:即Stopped或Traced,表示进程处于暂停或者跟踪状态X:Dead的缩写,表示进程已经死亡,所以不会在top或者ps命令中看到它
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND18570 gugoole 20 0 5658284 233192 146168 S 4.7 1.4 9:38.78 netease-cloud-m4360 root 20 0 496800 170776 114508 S 2.7 1.0 5:57.06 Xorg16076 gugoole 20 0 1903844 230852 56412 S 2.7 1.4 4:34.76 TIM.exe6692 gugoole 20 0 1250572 419552 86844 S 2.0 2.6 2:53.84 deepin-wm15877 gugoole 20 0 9540 6616 1952 S 2.0 0.0 3:34.32 wineserver.real29682 gugoole 20 0 618084 47944 34944 S 1.7 0.3 0:01.89 deepin-terminal18632 gugoole 20 0 3006760 537128 209068 S 1.0 3.3 3:13.91 netease-cloud-m4687 root -51 0 0 0 0 S 0.7 0.0 0:44.07 irq/150-nvidia2744 deepin-+ 20 0 440132 13640 12160 S 0.3 0.1 0:00.85 deepin-anything5788 root 20 0 1603368 74988 47088 S 0.3 0.5 0:17.94 dockerd5852 root 20 0 1687904 38928 25380 S 0.3 0.2 0:37.02 docker-containe10173 gugoole 20 0 2099056 17220 12796 S 0.3 0.1 0:58.93 pulseaudio30495 gugoole 20 0 1575640 325020 157892 S 0.3 2.0 0:17.71 chrome31658 gugoole 20 0 44436 3788 3120 R 0.3 0.0 0:00.04 top1 root 20 0 225760 9616 6768 S 0.0 0.1 0:02.42 systemd2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq7 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/08 root 20 0 0 0 0 I 0.0 0.0 0:03.38 rcu_sched9 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_bh
# 间隔1秒输出10组数据➜ ~ dstat 1 10You did not select any stats, using -cdngy by default.--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--usr sys idl wai stl| read writ| recv send| in out | int csw2 1 98 0 0| 433k 292k| 0 0 | 0 0 |1938 91041 0 99 0 0| 0 0 | 0 160B| 0 0 |2652 10k2 1 96 1 0| 0 168k| 60B 222B| 0 0 |2891 12k2 1 97 0 0| 0 0 | 0 0 | 0 0 |3184 14k4 1 95 0 0| 0 0 | 0 160B| 0 0 |3455 19k2 1 98 0 0| 0 0 | 652B 382B| 0 0 |3041 15k3 2 94 0 0| 0 0 | 0 0 | 0 0 |3493 16k1 1 98 0 0| 0 776k| 0 86B| 0 0 |2900 11k1 0 98 0 0| 0 0 | 138B 650B| 0 0 |2799 12k3 1 96 0 0| 0 0 | 121B 0 | 0 0 |2962 13k
# 观察进程对磁盘的读写# 每1秒输出各进程I/O情况,一共输出20组数据➜ ~ pidstat -d 1 20Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年12月07日 _x86_64_ (8 CPU)23时36分24秒 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command23时36分25秒 0 338 -1.00 -1.00 -1.00 5 jbd2/nvme0n1p3-23时36分25秒 1000 6770 0.00 3.96 0.00 0 dde-dock23时36分25秒 1000 16076 0.00 7.92 0.00 4 TIM.exe23时36分25秒 0 27818 -1.00 -1.00 -1.00 6 kworker/u16:323时36分25秒 1000 30495 0.00 11.88 0.00 0 chrome
# 每隔1秒输出进程16076的I/O情况,一共输出10组➜ ~ pidstat -d -p 16076 1 10Linux 4.15.0-29deepin-generic (gugoole-PC) 2018年12月07日 _x86_64_ (8 CPU)23时54分12秒 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command23时54分13秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分14秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分15秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分16秒 1000 16076 0.00 8.00 0.00 0 TIM.exe23时54分17秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分18秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分19秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分20秒 1000 16076 0.00 356.00 0.00 0 TIM.exe23时54分21秒 1000 16076 0.00 0.00 0.00 0 TIM.exe23时54分22秒 1000 16076 0.00 8.00 0.00 0 TIM.exe平均时间: 1000 16076 0.00 37.20 0.00 0 TIM.exe
pstree命令
# 显示进程14560的父进程➜ ~ pstree -aps 14560systemd,1 splash└─lightdm,3316└─lightdm,3868 --session-child 13 20└─startdde,4563└─chrome,13920└─chrome,13939└─chrome,13945└─chrome,14560
中断是一种异步事件的处理机制,可以提高系统的并发处理能力。为了减少对正常进程调度的影响,中断处理程序需要尽可能快的运行,为>> 了解决中断程序执行过长和中断丢失的问题,Linux将中断处理过程分成了两个阶段,即上半部与下半部。
ksoftirqd/CPU编号
proc/softirqs提供了软中断的运行情况proc/interrupts提供了硬中断的运行情况
需要注意以下两点:
- 要注意软中断的类型,即第一列
- 要注意同一软中断在不同CPU上的分布情况,正常情况下同一种中断在不同CPU上的累计次数差不多
# 每个TASKLET只运行一次就会结束,并且只在调用它的函数所在的CPU上运行,因此会导致调度不均衡,不能在多个CPU上并行而带来性能限制➜ ~ cat /proc/softirqsCPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7HI: 0 0 0 2 2 1 2 40TIMER: 154534 141883 143273 140968 146031 142005 155169 141926NET_TX: 7 1 3 3 117 4 1 0NET_RX: 560 773 848 805 520 878 975 652BLOCK: 0 0 0 0 0 0 0 0IRQ_POLL: 0 0 0 0 0 0 0 0TASKLET: 210 26 69 83 405 25 25 7380SCHED: 182731 138472 129632 121712 129113 124541 136262 123510HRTIMER: 0 0 0 0 0 0 0 0RCU: 113499 106495 108597 104906 109033 106882 112750 106392