[Feature] 运行窗口 CPU/内存曲线改用原生进程表与 Core 汇总,删除 ps/PowerShell 采样
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go, rust, typescript
- Domain
- desktop, performance
Research direction
Read desktop/internal/workbench/run_performance.go and the sysinfo.Process implementations under desktop/internal/sysinfo/ to trace the existing sampling path. Then inspect the Rust Core processMemory.summarize entry point and its shared fixtures; the issue calls for coverage of PID reuse, cycles, and process exit. Done means the run window uses native process data and Core aggregation, its memory figures match the status bar, and the old SampleProcessTree parsing code and related tests are removed.
Written by the indexing model from the issue text.
Description
Problem to solve / 要解决的问题
运行窗口的 CPU/内存曲线(desktop/internal/workbench/run_performance.go 的 startRunSampling)通过 pluginservice.SampleProcessTree 采样,实现在 desktop/internal/pluginservice/processsample.go、processsample_unix.go、processsample_windows.go:
- 每个运行中的任务每 2 秒启动一次外部命令读整张进程表:macOS/Linux 是
ps -axo pid=,ppid=,pcpu=,rss=,Windows 是powershell ... Get-CimInstance Win32_Process。PowerShell 冷启动本身就要几百毫秒和几十 MB 内存,多个运行同时存在时成倍增加。 - 内存口径是 RSS(Windows 是
WorkingSetSize),和活动监视器、任务管理器“内存”列不同。状态栏内存详情已改为 macOS 物理占用(ri_phys_footprint)、Windows 专用工作集(desktop/internal/sysinfo/process*.go的sysinfo.Processes),同一个进程在两处会显示不同的数字。 - 按父进程汇总进程树(
parsePSTable、parseWindowsTable)和 CPU 占比的计算写在 Go 平台层,属于可共享逻辑,按develop-lithe第三节应在 Rust Core。
判定依据:全仓库搜索 SampleProcessTree,唯一调用方是 run_performance.go:34;parsePSTable、psCommand、parseWindowsTable 只被这条路径使用。保留它的代价:每 2 秒一次子进程启动的开销、两处内存数字不一致,以及一份未进 Core 的进程树汇总逻辑。
Proposed solution / 建议方案
sysinfo.Process增加累计 CPU 时间(macOSproc_pid_rusage的ri_user_time + ri_system_time,WindowsGetProcessTimes,Linux/proc/<pid>/stat的 utime+stime),三端都不启动子进程。- 进程树汇总和两次采样之间的 CPU 占比计算放进 Rust Core(可以扩展
processMemory.summarize以某个根进程为范围,或新增一条命令),共享 fixture 覆盖进程号复用、环和进程退出。 - 运行曲线改用原生进程表和 Core 的结果,内存口径与状态栏内存详情一致;删除
SampleProcessTree、parsePSTable、psCommand、parseWindowsTable和 Windows 的windowsCPU缓存及对应测试。
风险:运行曲线的内存数字会从 RSS 变为物理占用/专用工作集,通常比原来小;需要在运行窗口的说明里同步口径。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Run / 运行
Priority / 优先级
P2 / 后续考虑:目前不着急,可安排到后续版本
Alternatives considered / 已考虑的替代方案
保留 ps/PowerShell,只把内存列换成同一口径:ps 拿不到物理占用,PowerShell 的启动开销也还在,所以不采用。
Additional context / 补充信息
状态栏内存详情改用原生进程表和 Core processMemory.summarize 的改动在分支 fix/memory-popover。那次改动删除了状态栏专用的 SampleProcessMemory,没有改运行曲线,因为曲线还需要 CPU 时间,而这需要单独设计 Core 接口。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 151
- Avg merge
- 3h 48m
- Merged PRs (30d)
- 571
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 1lck/Lithe-IDEA
-
review: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
1lck/Lithe-IDEA#2432 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 1/5 Under an hour Newbie friendliness 82/100
1lck/Lithe-IDEA#2431 ·
Maintainers usually reply within 1 day
-
refactor review: high
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
1lck/Lithe-IDEA#2376 ·
Maintainers usually reply within 1 day
-
area:ui enhancement P2 platform:cross-platform refactor review: high
Difficulty 1/5 Under an hour Newbie friendliness 84/100
1lck/Lithe-IDEA#2365 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 3/5 1-2 days Newbie friendliness 57/100
1lck/Lithe-IDEA#2434 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
rel: fix
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/fews-web-oc#2400 ·
Maintainers usually reply within 1 day
-
Command bar: Tab-to-search on claude.ai falls back to Google site: search instead of opening a prompt on ClaudePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ardia-browser/ardia#4426 ·
Maintainers usually reply within 1 day
-
Bug report: isValidISODateDashOnly accepts text before or after the date-timePossibly taken @bardrop claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
pnp/cli-microsoft365#7713 ·
Maintainers usually reply within 1 day
-
Diagram: Journey Type: Bug / Error
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mermaid-js/mermaid-v13#1293 ·
Maintainers usually reply within 1 day