htop: fix the patch that copes with disabled cores and hw.smt=0; it was

storing cpuids in an array but not using them and just using the array
index when looking up the stats. this works for cpus where the disabled
smt "cpu"s are at the end of the list but not where disabled/enabled
cores are interspersed as is the case with AMD. reported/tested by
Ashton Fagg.
This commit is contained in:
sthen 2020-11-29 20:15:05 +00:00
parent 52bc8156e8
commit 8d2506f4cf
2 changed files with 12 additions and 2 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.23 2020/09/12 17:25:21 ians Exp $
# $OpenBSD: Makefile,v 1.24 2020/11/29 20:15:05 sthen Exp $
COMMENT = interactive process viewer
GH_ACCOUNT = htop-dev
GH_PROJECT = htop
GH_TAGNAME = 3.0.1
REVISION = 0
CATEGORIES = sysutils

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-openbsd_OpenBSDProcessList_c,v 1.2 2020/09/11 12:34:28 rsadowski Exp $
$OpenBSD: patch-openbsd_OpenBSDProcessList_c,v 1.3 2020/11/29 20:15:05 sthen Exp $
Index: openbsd/OpenBSDProcessList.c
--- openbsd/OpenBSDProcessList.c.orig
@ -63,3 +63,12 @@ Index: openbsd/OpenBSDProcessList.c
}
return pl;
@@ -372,7 +397,7 @@ static void OpenBSDProcessList_scanCPUTime(OpenBSDProc
u_int64_t avg[CPUSTATES] = {0};
for (int i = 0; i < this->super.cpuCount; i++) {
- getKernelCPUTimes(i, kernelTimes);
+ getKernelCPUTimes(this->cpuIndex[i], kernelTimes);
CPUData* cpu = this->cpus + i + 1;
kernelCPUTimesToHtop(kernelTimes, cpu);