Handle dynamic changing of the number of active CPUs on OpenBSD#1619
Open
busterb wants to merge 2 commits intoaristocratos:mainfrom
Open
Handle dynamic changing of the number of active CPUs on OpenBSD#1619busterb wants to merge 2 commits intoaristocratos:mainfrom
busterb wants to merge 2 commits intoaristocratos:mainfrom
Conversation
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.
This is an additional set of improvements on #1587
The set of online CPUs can change dynamically while btop is running, but the stats vectors and UI were only sized in init(). If the number of CPUs increases, say by switching hw.smt from 0 to 1, or with OpenBSD 7.9 removing 'S' from hw.blockcpu, the resulting vector is too small, resulting in this error:
ERROR: Exception in runner thread -> Cpu:: -> collect() : vector
This adds an additional check on each collect() call for the number of currently online CPUs. It also sets Runner::coreNum_reset when there is a change so the display is updated for the current number of CPUs.
Tested on an assortment of machines from 4 to 16 CPUs.