don't include offline CPUs in summary for OpenBSD#580
don't include offline CPUs in summary for OpenBSD#580sthen wants to merge 1 commit intohtop-dev:masterfrom sthen:openbsd_cpuonline
Conversation
|
Can you squash your commits? Makes the history cleaner and easier to follow. |
|
On 2021/03/28 13:37, BenBE wrote:
Can you squash your commits? Makes the history cleaner and easier to follow.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.*
If you can tell me what to type to do that, yes. (I don't normally use git).
|
|
When on your branch: # Fetch latest changes
git fetch --all
# Apply latest changes
git pull --rebase your-repo your-branch
# Base local changes on upstream master
git rebase -i htop-upstream/master
# Push the modified branch to your repo to update this PR.
git push --force-with-lease your-repo your-branchIn the editor that opens change the second line from |
|
|
||
| if (cpu_index_c == pl->cpuCount) | ||
| break; | ||
| } |
There was a problem hiding this comment.
What is this loop about?
cpu_index_c is being increased and the loop is aborted when it reaches a specific value, but there are no further implications.
There was a problem hiding this comment.
Hmm, looks like I missed a bit when I was merging the patch which was originally done against 3.0.1. It will work on Intel CPUs without that loop (the skipped cpus are the higher numbered ones) but they're interspersed on AMD (skipped would be 1,3,5,7,..) I just pushed an updated version that I think should do the trick (I don't have an AMD cpu with SMT to test that part with though)
There was a problem hiding this comment.
I asked someone to test on AMD, this version is looking ok.
| pl->cpuCount = 1; | ||
| } | ||
| opl->cpus = xCalloc(pl->cpuCount + 1, sizeof(CPUData)); | ||
| opl->cpuIndex = xRealloc(opl->cpuIndex, pl->cpuCount * sizeof(int)); |
There was a problem hiding this comment.
*opl was initialized in this function, no need to realloc (just malloc (or calloc, see later comment))
| size = sizeof(cpu_stats); | ||
| for (unsigned int i = 0; i < ncpu; i++) { | ||
| ncmib[2] = i; | ||
| sysctl(ncmib, 3, &cpu_stats, &size, NULL, 0); |
There was a problem hiding this comment.
please check for a sysctl failure
| CPUData* cpus; | ||
| int cpuSpeed; | ||
|
|
||
| int* cpuIndex; |
There was a problem hiding this comment.
Maybe include the index in the CPUData struct (the one unused int of the average entry is negligible)
By default, OpenBSD disables SMT (hyperthreading) cpu pseudo-cores. This can be changed at runtime by setting the hw.smt sysctl so they may become active later, therefore they are still present in cpu stat structures but are marked as offline. As done with native top(1), this drops them from the cpu summary graphs.
|
|
||
| size = sizeof(cpu_stats); | ||
| for (unsigned int i = 0; i < ncpu; i++) { | ||
| ncmib[2] = i; |
There was a problem hiding this comment.
Move actual initialization of ncmib here and make it const.
| ncmib[2] = i; | |
| const int ncmib[] = { CTL_KERN, KERN_CPUSTATS, i }; |
| const int fmib[] = { CTL_KERN, KERN_FSCALE }; | ||
| int ncmib[] = { CTL_KERN, KERN_CPUSTATS, 0 }; | ||
| int r; | ||
| unsigned int cpu_index_c = 0, ncpu; |
| size = sizeof(cpu_stats); | ||
| for (unsigned int i = 0; i < ncpu; i++) { | ||
| ncmib[2] = i; | ||
| if (sysctl(ncmib, 3, &cpu_stats, &size, NULL, 0) < 0) { |
There was a problem hiding this comment.
Shouldn't size be re-initialized inside the loop?
|
Since you have a pretty clear idea of what changes you want, could one of you fix it up please? Most of my development work is with OpenBSD and we don't use git so what is probably a 2 minute job for you takes me about half an hour each time to figure out how to rebase the commit history how you want it. Thanks! |
|
Applied with adjustments via feec16c. |
|
Many thanks. |
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
Currently htop does not support offline CPUs and hot-swapping, e.g. via
echo 0 > /sys/devices/system/cpu/cpu2/online
Split the current single cpuCount variable into activeCPUs and
existingCPUs.
Supersedes: htop-dev#650
Related: htop-dev#580
By default, OpenBSD disables SMT (hyperthreading) cpu pseudo-cores.
This can be changed at runtime by setting the hw.smt sysctl so they
may become active later, therefore they are still present in cpu
stat structures but are marked as offline.
As done with native top(1), this drops them from the cpu summary
graphs.