merge back in a bit more of the previous offline CPUs patch which I think
should re-unbreak AMD SMT
This commit is contained in:
parent
c062270609
commit
358bfe7e70
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: Makefile,v 1.26 2021/03/29 17:18:43 sthen Exp $
|
# $OpenBSD: Makefile,v 1.27 2021/04/03 11:13:48 sthen Exp $
|
||||||
|
|
||||||
COMMENT = interactive process viewer
|
COMMENT = interactive process viewer
|
||||||
|
|
||||||
@ -7,6 +7,7 @@ GH_PROJECT = htop
|
|||||||
#GH_TAGNAME = 3.0.5
|
#GH_TAGNAME = 3.0.5
|
||||||
GH_COMMIT = 272e72680b84a52183d39a519d6704324063bae1
|
GH_COMMIT = 272e72680b84a52183d39a519d6704324063bae1
|
||||||
DISTNAME = htop-3.0.5pl20210325
|
DISTNAME = htop-3.0.5pl20210325
|
||||||
|
REVISION = 0
|
||||||
|
|
||||||
CATEGORIES = sysutils
|
CATEGORIES = sysutils
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$OpenBSD: patch-openbsd_OpenBSDProcessList_c,v 1.5 2021/03/29 17:18:43 sthen Exp $
|
$OpenBSD: patch-openbsd_OpenBSDProcessList_c,v 1.6 2021/04/03 11:13:48 sthen Exp $
|
||||||
|
|
||||||
Don't include "offline" CPUs in the stats (i.e. CPUs which have been
|
Don't include "offline" CPUs in the stats (i.e. CPUs which have been
|
||||||
disabled by sysctl hw.smt=0).
|
disabled by sysctl hw.smt=0).
|
||||||
@ -25,9 +25,11 @@ Index: openbsd/OpenBSDProcessList.c
|
|||||||
|
|
||||||
OpenBSDProcessList* opl = xCalloc(1, sizeof(OpenBSDProcessList));
|
OpenBSDProcessList* opl = xCalloc(1, sizeof(OpenBSDProcessList));
|
||||||
ProcessList* pl = (ProcessList*) opl;
|
ProcessList* pl = (ProcessList*) opl;
|
||||||
@@ -54,6 +58,12 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H
|
@@ -53,7 +57,14 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H
|
||||||
|
pl->cpuCount = 1;
|
||||||
}
|
}
|
||||||
opl->cpus = xCalloc(pl->cpuCount + 1, sizeof(CPUData));
|
opl->cpus = xCalloc(pl->cpuCount + 1, sizeof(CPUData));
|
||||||
|
+ opl->cpuIndex = xRealloc(opl->cpuIndex, pl->cpuCount * sizeof(int));
|
||||||
|
|
||||||
+ size = sizeof(int);
|
+ size = sizeof(int);
|
||||||
+ r = sysctl(nmib, 2, &ncpu, &size, NULL, 0);
|
+ r = sysctl(nmib, 2, &ncpu, &size, NULL, 0);
|
||||||
@ -38,22 +40,32 @@ Index: openbsd/OpenBSDProcessList.c
|
|||||||
size = sizeof(fscale);
|
size = sizeof(fscale);
|
||||||
if (sysctl(fmib, 2, &fscale, &size, NULL, 0) < 0) {
|
if (sysctl(fmib, 2, &fscale, &size, NULL, 0) < 0) {
|
||||||
CRT_fatalError("fscale sysctl call failed");
|
CRT_fatalError("fscale sysctl call failed");
|
||||||
@@ -75,6 +85,18 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H
|
@@ -76,6 +87,19 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H
|
||||||
}
|
|
||||||
|
|
||||||
opl->cpuSpeed = -1;
|
opl->cpuSpeed = -1;
|
||||||
+
|
|
||||||
+ size = sizeof(cpu_stats);
|
+ size = sizeof(cpu_stats);
|
||||||
+ for (unsigned int i = 0; i < ncpu; i++) {
|
+ for (unsigned int i = 0; i < ncpu; i++) {
|
||||||
+ ncmib[2] = i;
|
+ ncmib[2] = i;
|
||||||
+ sysctl(ncmib, 3, &cpu_stats, &size, NULL, 0);
|
+ sysctl(ncmib, 3, &cpu_stats, &size, NULL, 0);
|
||||||
+ if (cpu_stats.cs_flags & CPUSTATS_ONLINE) {
|
+ if (cpu_stats.cs_flags & CPUSTATS_ONLINE) {
|
||||||
|
+ opl->cpuIndex[cpu_index_c] = i;
|
||||||
+ cpu_index_c++;
|
+ cpu_index_c++;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (cpu_index_c == pl->cpuCount)
|
+ if (cpu_index_c == pl->cpuCount)
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -332,7 +356,7 @@ static void OpenBSDProcessList_scanCPUTime(OpenBSDProc
|
||||||
|
u_int64_t avg[CPUSTATES] = {0};
|
||||||
|
|
||||||
|
for (unsigned 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);
|
||||||
|
|
||||||
|
14
sysutils/htop/patches/patch-openbsd_OpenBSDProcessList_h
Normal file
14
sysutils/htop/patches/patch-openbsd_OpenBSDProcessList_h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
$OpenBSD: patch-openbsd_OpenBSDProcessList_h,v 1.5 2021/04/03 11:13:49 sthen Exp $
|
||||||
|
|
||||||
|
Index: openbsd/OpenBSDProcessList.h
|
||||||
|
--- openbsd/OpenBSDProcessList.h.orig
|
||||||
|
+++ openbsd/OpenBSDProcessList.h
|
||||||
|
@@ -43,7 +43,7 @@ typedef struct OpenBSDProcessList_ {
|
||||||
|
|
||||||
|
CPUData* cpus;
|
||||||
|
int cpuSpeed;
|
||||||
|
-
|
||||||
|
+ int* cpuIndex;
|
||||||
|
} OpenBSDProcessList;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user