当为了节省电量而使屏幕变黑时(这会导致笔记本电脑的风扇旋转起来),top 记录了 gnome-shell 近 100% 的 CPU 使用率。
据我所知,在锁定屏幕或者正常使用。即使禁用扩展程序后,这种情况仍会发生。
strace -tt -C -p <shell_pid>
大约半小时后的结果显示大部分时间都花在了 syscall 上clock_gettime
。
clock_gettime
您可以通过毫秒时间戳查看调用的次数。
18:48:00.522445 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100562526}) = 0
18:48:00.522466 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100584280}) = 0
18:48:00.522488 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100605864}) = 0
18:48:00.522509 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100626624}) = 0
18:48:00.522530 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100648323}) = 0
18:48:00.522552 sched_yield() = 0
18:48:00.522572 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100689927}) = 0
18:48:00.522593 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100710853}) = 0
18:48:00.522614 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100731603}) = 0
18:48:00.522635 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100753229}) = 0
18:48:00.522659 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100777169}) = 0
18:48:00.522681 sched_yield() = 0
18:48:00.522701 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100819210}) = 0
18:48:00.522722 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100840009}) = 0
18:48:00.522743 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100860806}) = 0
18:48:00.522765 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100882561}) = 0
18:48:00.522786 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100904282}) = 0
18:48:00.522808 sched_yield() = 0
18:48:00.522828 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100946215}) = 0
18:48:00.522849 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100966912}) = 0
18:48:00.522871 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=100988572}) = 0
18:48:00.522891 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=101009223}) = 0
18:48:00.522913 clock_gettime(CLOCK_MONOTONIC, {tv_sec=799890, tv_nsec=101031062}) = 0
18:48:00.522934 sched_yield() = 0
概括:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
83.52 89.095703 1 62036388 clock_gettime
16.18 17.256415 1 11762594 sched_yield
0.06 0.067132 2 38689 37883 recvmsg
0.05 0.056288 28 1998 ioctl
0.04 0.046645 2 30383 getpid
0.03 0.030072 2 13064 10060 access
0.02 0.023227 3 8150 poll
0.02 0.022970 2 12046 read
0.02 0.020675 2 9445 write
0.02 0.020551 5 3789 41 futex
0.01 0.007880 3 2775 96 openat
0.01 0.006374 2 3048 36 stat
0.01 0.005624 2 2766 close
0.01 0.005472 2 3000 getuid
0.01 0.005397 2 3590 mprotect
0.00 0.004370 2 2682 fstat
0.00 0.003257 4 902 writev
0.00 0.000292 3 94 mmap
0.00 0.000176 2 87 timerfd_create
0.00 0.000137 2 68 getrusage
0.00 0.000133 2 87 timerfd_settime
0.00 0.000059 7 8 getdents
0.00 0.000058 6 9 getrandom
0.00 0.000056 14 4 nanosleep
0.00 0.000027 7 4 inotify_add_watch
0.00 0.000006 2 3 madvise
0.00 0.000006 1 7 recvfrom
0.00 0.000000 0 1 uname
0.00 0.000000 0 3 fcntl
0.00 0.000000 0 1 restart_syscall
------ ----------- ----------- --------- --------- ----------------
100.00 106.679002 73935685 48116 total
禁用时钟秒没有帮助。
可能相关的错误报告: