From: Brent Cook Subject: Re: [Fix] Patch btop to report active CPU usage correctly, remove desktop runtime dependency To: Theo Buehler Cc: ports@openbsd.org Date: Fri, 17 Apr 2026 07:53:46 -0500 is On Thu, Apr 16, 2026 at 11:14 PM Theo Buehler wrote: > > On Thu, Apr 16, 2026 at 09:47:54PM -0500, Brent Cook wrote: > > I like to use btop to monitor resource usage on servers, but it wasn't > > reporting per-core CPU usage correctly on OpenBSD. I reported and got > > the issue fixed upstream, but it might be a while until the next > > release, so I wanted to pull that diff into ports in the mean time: > > > > https://github.com/aristocratos/btop/pull/1587 > > > The CPU one makes sense to me and it definitely improves things in the > default display. However, the tool can't handle CPUs being added at > runtime. If you remove S from hw.blockcpu (or toggle hw.smt 0 -> 1), > a running btop throws an exception and dies: > > ERROR: Exception in runner thread -> Cpu:: -> collect() : vector > > I have no real opinion on whether that is acceptable or not. It doesn't > look like an absolute blocker to me, but it doesn't seem ideal. > > You'd need to add REVISION=0 to the Makefile, and I would also add a link > to your PR at the top of the patch. Here's v2, with a check made to active CPU count on each poll so the stats vectors are resized and the UI is redrawn when that changes. My 4 core machine didn't crash for some reason in testing, but I think this is the right way to handle this. The Linux path was doing something similar, albeit less efficiently since it has to resize the vector one by one as it reads /proc files instead. I also added REVISION to this patch so it bumps the package version. I'm going to drop the dependency changes for now. That was more of a nice-to-have than a fix, and sounds like something we could address more broadly later. Thanks for the feedback!