![游戏每 7 分钟左右就会卡顿一次](https://linux22.com/image/1098391/%E6%B8%B8%E6%88%8F%E6%AF%8F%207%20%E5%88%86%E9%92%9F%E5%B7%A6%E5%8F%B3%E5%B0%B1%E4%BC%9A%E5%8D%A1%E9%A1%BF%E4%B8%80%E6%AC%A1.png)
每当我在 Linux 机器上玩游戏时,它每隔 7 分钟左右就会卡顿一次,持续约 5 秒钟。这似乎不是一个严重的问题,但仍然有点烦人。所以,有没有关于如何追踪该错误的原因,然后尝试修复它的想法。
我的 Acer aspire 5552g 上安装了 Ubuntu 12.10,它具有:
- AMD 2.20 GHz 处理器
- Radeon HD 5650 配备最新的 AMD 专有驱动程序。
- 4 GB RAM
- DE:侏儒3
更新:
出现卡顿时,我查看了 CPU 使用率图表,结果显示一个核心(双核)在出现这种情况时上升到了 100%,而另一个核心保持不变。这可能是 CPU 故障的征兆,还是操作系统安装不当?
这实际上似乎是 Xorg 的问题。当出现卡顿时,Xorg 似乎占用了我大约 60% 的 CPU 容量。
关于如何从现在开始排除故障,您有什么想法吗?
现在检查日志文件,这是我拥有的日志列表:
kaspar@kaspar-pc:/var/log$ ls
alternatives.log btmp.1 jockey.log.2.gz syslog.3.gz
alternatives.log.1 ConsoleKit kern.log syslog.4.gz
apport.log cups kern.log.1 syslog.5.gz
apport.log.1 dist-upgrade kern.log.2.gz syslog.6.gz
apport.log.2.gz dmesg kern.log.3.gz syslog.7.gz
apport.log.3.gz dmesg.0 kern.log.4.gz udev
apport.log.4.gz dmesg.1.gz lastlog ufw.log
apport.log.5.gz dmesg.2.gz lightdm unattended-upgrades
apport.log.6.gz dmesg.3.gz mail.err upstart
apport.log.7.gz dmesg.4.gz mail.log wtmp
apt dpkg.log news wtmp.1
auth.log dpkg.log.1 pm-powersave.log Xorg.0.log
auth.log.1 faillog pm-powersave.log.1 Xorg.0.log.old
auth.log.2.gz fontconfig.log pm-suspend.log Xorg.1.log
auth.log.3.gz fsck pm-suspend.log.1 Xorg.1.log.old
auth.log.4.gz gdm samba Xorg.2.log
boot hp speech-dispatcher Xorg.2.log.old
boot.log installer syslog Xorg.3.log
bootstrap.log jockey.log syslog.1 Xorg.failsafe.log
btmp jockey.log.1 syslog.2.gz Xorg.failsafe.log.old
这是 syslog 的尾部 -F:
kaspar@kaspar-pc:~$ tail -F /var/log/syslog
Feb 23 00:39:41 kaspar-pc kernel: [18312.601860] ptrace of pid 5563 was attempted by: wineserver (pid 4058)
Feb 23 00:39:41 kaspar-pc kernel: [18312.601915] ptrace of pid 8585 was attempted by: wineserver (pid 4058)
Feb 23 00:39:41 kaspar-pc kernel: [18312.608335] ptrace of pid 4064 was attempted by: wineserver (pid 4058)
Feb 23 00:39:41 kaspar-pc kernel: [18312.608402] ptrace of pid 4068 was attempted by: wineserver (pid 4058)
Feb 23 00:39:41 kaspar-pc kernel: [18312.608454] ptrace of pid 4076 was attempted by: wineserver (pid 4058)
Feb 23 00:40:44 kaspar-pc kernel: [18376.177046] yama_ptrace_access_check: 4 callbacks suppressed
Feb 23 00:40:44 kaspar-pc kernel: [18376.177051] ptrace of pid 4064 was attempted by: wineserver (pid 4058)
Feb 23 00:40:44 kaspar-pc kernel: [18376.177103] ptrace of pid 4068 was attempted by: wineserver (pid 4058)
Feb 23 00:40:44 kaspar-pc kernel: [18376.177154] ptrace of pid 4076 was attempted by: wineserver (pid 4058)
Feb 23 00:40:44 kaspar-pc kernel: [18376.177204] ptrace of pid 4085 was attempted by: wineserver (pid 4058)
我不知道如何让列表正确显示。但我可以看到那里syslog
只有关于 Wine 的几行,而不是我的问题。所以我可能需要查看其他日志,但要查看哪些日志。
我运行了半个小时的更新日志:
kaspar@kaspar-pc:~$ tail -F /var/log/syslog
Feb 23 11:10:12 kaspar-pc kernel: [26160.563462] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.563502] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.563537] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.563572] ptrace of pid 18082 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.568618] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.568661] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.568697] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26160.568733] ptrace of pid 18082 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26161.074357] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:10:12 kaspar-pc kernel: [26161.074413] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217175] yama_ptrace_access_check: 23 callbacks suppressed
Feb 23 11:14:03 kaspar-pc kernel: [26391.217181] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217218] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217254] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217292] ptrace of pid 18082 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217500] ptrace of pid 18109 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217536] ptrace of pid 18124 was attempted by: wineserver (pid 18055)
Feb 23 11:14:03 kaspar-pc kernel: [26391.217571] ptrace of pid 18429 was attempted by: wineserver (pid 18055)
Feb 23 11:14:04 kaspar-pc kernel: [26392.427695] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:14:04 kaspar-pc kernel: [26392.427737] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:14:04 kaspar-pc kernel: [26392.427775] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:14:58 kaspar-pc cracklib: no dictionary update necessary.
tail: `/var/log/syslog' has become inaccessible: No such file or directory
tail: cannot watch `/var/log/syslog': Permission denied
tail: cannot watch `/var/log/syslog': Permission denied
tail: `/var/log/syslog' has appeared; following end of new file
Feb 23 11:16:13 kaspar-pc anacron[12106]: Job `cron.daily' terminated
Feb 23 11:16:13 kaspar-pc anacron[12106]: Normal exit (1 job run)
Feb 23 11:17:02 kaspar-pc CRON[18745]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994551] yama_ptrace_access_check: 5 callbacks suppressed
Feb 23 11:48:12 kaspar-pc kernel: [28437.994556] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994594] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994631] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994667] ptrace of pid 18082 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994702] ptrace of pid 18109 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994738] ptrace of pid 18124 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.994773] ptrace of pid 18429 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.999638] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.999678] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:48:12 kaspar-pc kernel: [28437.999714] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:48:38 kaspar-pc kernel: [28463.842282] yama_ptrace_access_check: 4 callbacks suppressed
Feb 23 11:48:38 kaspar-pc kernel: [28463.842288] ptrace of pid 18061 was attempted by: wineserver (pid 18055)
Feb 23 11:48:38 kaspar-pc kernel: [28463.842339] ptrace of pid 18065 was attempted by: wineserver (pid 18055)
Feb 23 11:48:38 kaspar-pc kernel: [28463.842390] ptrace of pid 18074 was attempted by: wineserver (pid 18055)
Feb 23 11:48:38 kaspar-pc kernel: [28463.842441] ptrace of pid 18082 was attempted by: wineserver (pid 18055)
发生卡顿的时间戳是 11.21 11.31 11.36 11.41 和 11.46 根据该日志,这些时间没有发生任何事情。
来自 kern.log 的日志
kaspar@kaspar-pc:~$ tail -F /var/log/kern.log
Feb 24 18:13:38 kaspar-pc kernel: [33595.438757] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.438797] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.438833] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.438868] ptrace of pid 22784 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.440681] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.440716] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.440751] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
Feb 24 18:13:38 kaspar-pc kernel: [33595.440785] ptrace of pid 22784 was attempted by: wineserver (pid 22757)
Feb 24 18:13:39 kaspar-pc kernel: [33596.007100] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:13:39 kaspar-pc kernel: [33596.007139] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269211] yama_ptrace_access_check: 23 callbacks suppressed
Feb 24 18:18:36 kaspar-pc kernel: [33893.269216] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269257] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269296] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269335] ptrace of pid 22784 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269374] ptrace of pid 22816 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269413] ptrace of pid 22831 was attempted by: wineserver (pid 22757)
Feb 24 18:18:36 kaspar-pc kernel: [33893.269452] ptrace of pid 23091 was attempted by: wineserver (pid 22757)
Feb 24 18:18:37 kaspar-pc kernel: [33894.217138] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:18:37 kaspar-pc kernel: [33894.217192] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:18:37 kaspar-pc kernel: [33894.217243] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.769962] yama_ptrace_access_check: 5 callbacks suppressed
Feb 24 18:57:59 kaspar-pc kernel: [36252.769968] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770047] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770107] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770159] ptrace of pid 22784 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770209] ptrace of pid 22816 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770259] ptrace of pid 22831 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.770310] ptrace of pid 23091 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.778003] ptrace of pid 22763 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.778045] ptrace of pid 22767 was attempted by: wineserver (pid 22757)
Feb 24 18:57:59 kaspar-pc kernel: [36252.778093] ptrace of pid 22775 was attempted by: wineserver (pid 22757)
看到这个日志,似乎错误又一次没有出现。
编辑:在卡顿发生时将一些屏幕截图与顶部监控链接起来。也许这有点帮助。
可以看出,当出现卡顿时,Xorg 会占用一个核心的大量处理能力。这次只有 12.6%,但更严重的卡顿会占用高达 37% 的资源,这会导致真正的锁定几秒钟。另外,我想知道这是否是 Xorg 的错误,我是否不应该查看 Xorg 日志?但我应该监控哪一个,因为日志太多了。此外,当我尝试监控 Xorg.3.log 时,它没有显示任何错误的时间戳,所以我想从那里读取信息可能很困难。
答案1
如果你尚未安装 AMD 显卡驱动程序,可以下载这里
如果不起作用,请尝试卸载并重新安装 xorg,使用
sudo apt-get remove --purge xserver-xorg
然后
sudo apt-get install xserver-xorg
答案2
这可能只是游戏错误(或漏洞)。尝试重新安装游戏,或重新安装 Ubuntu。获取更多 RAM 和 64 位版本的 Ubuntu 可能会有所帮助。此外,笔记本电脑总是比 PC 慢。