有一个带有 vlc 进程的服务器用于实时视频编码。
这是top
with 1
(show processor) 和H
(show threads)的输出
top - 15:50:26 up 42 min, 1 user, load average: 2.64, 2.60, 2.45
Tasks: 130 total, 7 running, 123 sleeping, 0 stopped, 0 zombie
Cpu0 : 0.0%us, 0.3%sy, 72.2%ni, 26.8%id, 0.0%wa, 0.0%hi, 0.7%si, 0.0%st
Cpu1 : 0.0%us, 0.0%sy, 56.0%ni, 44.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 2.6%us, 0.0%sy, 9.4%ni, 87.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.3%st
Cpu3 : 0.0%us, 0.0%sy, 35.9%ni, 64.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 : 0.0%us, 0.0%sy, 35.0%ni, 65.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 2.6%us, 0.0%sy, 0.0%ni, 97.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu6 : 0.0%us, 0.6%sy, 18.0%ni, 81.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu7 : 4.9%us, 0.0%sy, 0.0%ni, 95.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 533064k total, 233000k used, 300064k free, 4832k buffers
Swap: 2097144k total, 0k used, 2097144k free, 40516k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5841 videoenc 20 0 674m 119m 8228 R 8.0 22.9 2:32.50 vlc
5840 videoenc 20 0 674m 119m 8228 S 4.7 22.9 1:49.53 vlc
5843 videoenc 20 0 674m 119m 8228 R 4.7 22.9 1:45.36 vlc
22787 videoenc 30 10 674m 119m 8228 R 4.7 22.9 0:00.14 vlc
22788 videoenc 30 10 674m 119m 8228 S 2.0 22.9 0:00.06 vlc
22789 videoenc 30 10 674m 119m 8228 R 1.3 22.9 0:00.04 vlc
5838 videoenc 20 0 674m 119m 8228 S 0.7 22.9 0:08.14 vlc
22790 videoenc 30 10 674m 119m 8228 S 0.7 22.9 0:00.02 vlc
22791 videoenc 30 10 674m 119m 8228 S 0.7 22.9 0:00.02 vlc
这是top
(没有1
和H
)的组合输出
top - 16:01:09 up 52 min, 1 user, load average: 3.88, 3.74, 3.10
Tasks: 110 total, 1 running, 109 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.2%us, 0.1%sy, 35.2%ni, 63.2%id, 0.1%wa, 0.0%hi, 0.0%si, 0.1%st
Mem: 533064k total, 234136k used, 298928k free, 5208k buffers
Swap: 2097144k total, 0k used, 2097144k free, 40992k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5825 videoenc 20 0 674m 119m 8228 S 305 22.9 98:59.58 vlc
1 root 20 0 10328 736 616 S 0 0.1 0:00.08 init
2 root 15 -5 0 0 0 S 0 0.0 0:00.00 kthreadd
3 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/0
4 root 15 -5 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
5 root 15 -5 0 0 0 S 0 0.0 0:00.04 events/0
6 root 15 -5 0 0 0 S 0 0.0 0:00.00 khelper
8 root 15 -5 0 0 0 S 0 0.0 0:00.00 xenbus
10 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/1
11 root 15 -5 0 0 0 S 0 0.0 0:00.00 ksoftirqd/1
12 root 15 -5 0 0 0 S 0 0.0 0:00.02 events/1
13 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/2
14 root 15 -5 0 0 0 S 0 0.0 0:00.00 ksoftirqd/2
15 root 15 -5 0 0 0 S 0 0.0 0:00.02 events/2
16 root RT -5 0 0 0 S 0 0.0 0:00.00 migration/3
17 root 15 -5 0 0 0 S 0 0.0 0:00.00 ksoftirqd/3
这是一个问题:
为什么所有 %CPU 的总和不等于 %ni 的总和。以及为什么 VLC 在没有运行时会产生“不错”的负载renice
VLC 中的线程之一或它用于编码的库之一可能正在使用 setpriority() 来更改它创建的线程的优先级/友好性
您在 Irix 模式下运行 TOP,它将 CPU % 显示为单个 CPU 的百分比。按“I”切换到 Solaris 模式,它将 CPU % 显示为所有 CPU 的百分比。
从手册页: