-
-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetBSD: Rework CPU counting. #718
Conversation
44fef22
to
ce79678
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with writing it like this?
ce79678
to
f602fbf
Compare
f602fbf
to
096e4ab
Compare
096e4ab
to
42168cd
Compare
@BenBE I should probably visit the code base again once the merge is done, and refactor some of the variable names used, I liked the above suggestion to give it meaningful names in a self-documenting style. |
bbc5614
to
305d52b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tweaking some final stuff I noticed one last thing with the online
field in the CPUData
structure: The field is only ever written for the average (CPU 0
), but never for any of the actual cores (1
..super->activeCPUs
). Please recheck if there is anything missing or drop a short note if I just missed some code that properly updates the online information.
You are right, I have only done minimal implementation of CPU counting and I looked around in the documentation to understand how to do check on multiple CPUs and see if online / offline CPUs can be detected. Due to the lack of time and being unable to find the exact information I am looking for, I went for the base implementation of having to deal only with CPU 0. I will need a bit more time from my end to figure out how multi CPU stuff works in NetBSD. I can do a follow up with @alarixnia and see if I can learn more about this after the merge. |
Okay, then I'd suggest to skip the For now I'd propose to amend as follows and do the per-core online status in a follow-up PR: $ git diff
diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c
index c35946ae..a3530de7 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessList.c
@@ -93,7 +93,6 @@ static void NetBSDProcessList_updateCPUcount(ProcessList* super) {
memset(dAvg, '\0', sizeof(CPUData));
dAvg->totalTime = 1;
dAvg->totalPeriod = 1;
- dAvg->online = true;
for (unsigned int i = 0; i < super->existingCPUs; i++) {
CPUData* d = &opl->cpuData[i + 1];
@@ -480,5 +479,5 @@ bool ProcessList_isCPUonline(const ProcessList* super, unsigned int id) {
assert(id < super->existingCPUs);
const NetBSDProcessList* npl = (const NetBSDProcessList*) super;
- return npl->cpuData[id + 1].online;
+ return true;
}
diff --git a/netbsd/NetBSDProcessList.h b/netbsd/NetBSDProcessList.h
index 14b09312..1d1407d8 100644
--- a/netbsd/NetBSDProcessList.h
+++ b/netbsd/NetBSDProcessList.h
@@ -39,7 +39,6 @@ typedef struct CPUData_ {
unsigned long long int idlePeriod;
double frequency;
- bool online;
} CPUData;
typedef struct NetBSDProcessList_ { |
305d52b
to
7d18c58
Compare
Should be done in the latest commit, also put a TODO reminder for this in the code. |
7d18c58
to
b722a37
Compare
This is the continuation of the work done in #656
Refactors the code in NetBSD to comply with the changes.