Repository navigation
开机守护头 30 分钟每分钟记内存、缺页和换页,问题包判断开机期间宿主内存紧不紧张 - #219
Merged
Merged
Conversation
开机守护在开机后头 30 分钟每分钟写一行内存(之后照旧,另在电脑变得内存 紧张或不再紧张时写一行),在原来那行后面加上 qemu 的缺页和硬缺页增量、电脑 从盘换入换出的页数增量、主窗口状态、电源,以及开机时和之后电脑上别的模拟器 进程(只记进程名和内存)。同样的数以 JSON 字段带在日志行上。 问题包的 summary.txt 新加「开机期间的宿主内存(开机守护记录)」一节:按最近 5 次开机,开机后 30 分钟内 qemu 工作集被修剪到提交量的 30 % 以下(且比之前 少了 1 GB 以上),同时电脑提交到上限的 95 % 以上、可用物理内存不到 1 GB 或 页面文件扩容,就写「这次开机期间宿主内存紧张」。 只用系统自带的接口(GetProcessMemoryInfo、NtQuerySystemInformation、PDH、 GetSystemPowerStatus、EnumWindows / IsIconic),读不到的写「读不到」。 Refs ModAVD/ModAVD#254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs ModAVD/ModAVD#254
用户说「刚开机前几分钟卡」时,现在的问题包只有开机守护在变化大或满 10 分钟时记的一行内存,看不出是不是电脑内存不够、Windows 把模拟器的内存修剪出去了,也看不出当时还开着哪些别的模拟器、窗口是不是最小化、笔记本是不是用电池。这个 PR 让开机守护自己把这些记下来,问题包里直接给出判断,不用再问用户。
开机守护(
modavd-bootwatch.log)\Memory\Pages Input/sec、Pages Output/sec的原始计数);memory、other_emulators)带在这一行上,供问题包读。GetProcessMemoryInfo、NtQuerySystemInformation(SystemProcessInformation)(一次读出所有进程的名字、工作集、提交和硬缺页,不打开别的进程)、PDH(PdhAddEnglishCounterW,和系统语言无关)、GetSystemPowerStatus、EnumWindows/IsIconic/GetForegroundWindow。没有新依赖;非 Windows 平台上这些函数返回不支持(开机守护在那里本来就不采内存)。问题包
summary.txt 新加一节「开机期间的宿主内存(开机守护记录)」,从包里的开机守护日志(连同
.1)里按 qemu 进程分开,最近 5 次开机,每次写:这一版以前的开机守护日志没有这些字段,这一节就写「没有内存记录」。
测试
GetProcessMemoryInfo;换页计数两次读只增不减;电源读得到)。go test ./...、go vet ./...全过;GOOS=darwin GOARCH=arm64、GOOS=linux GOARCH=amd64、GOOS=windows GOARCH=arm64下go vet ./...和go test -c过。