Skip to content

Improve CPU load calculation#105

Merged
LeandroMartinsdS merged 14 commits into
dls-masterfrom
CPU_CoreManagement
May 14, 2024
Merged

Improve CPU load calculation#105
LeandroMartinsdS merged 14 commits into
dls-masterfrom
CPU_CoreManagement

Conversation

@LeandroMartinsdS
Copy link
Copy Markdown
Contributor

Improve CPU load calculation for Power PMAC, being possible to read the usage for up to 4 cores.
For ARM architecture, supports custom core management reading the core that executes each task (phase, servo, RT and background).

Copy link
Copy Markdown

@JamesOHeaDLS JamesOHeaDLS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @LeandroMartinsdS

Overall it looks good. I have added some inline review comments to the code.

Have you tested how the system behaves if no CPU is recognised?

Thanks,

James

Comment thread pmacApp/src/pmacController.cpp
Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/src/pmacController.cpp
Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/src/pmacController.h Outdated
Comment thread pmacApp/src/pmacController.h Outdated
Comment thread pmacApp/src/pmacController.h Outdated
Comment thread pmacApp/src/pmacController.cpp
@LeandroMartinsdS
Copy link
Copy Markdown
Contributor Author

I made this test
Have you tested how the system behaves if no CPU is recognised?

Now, the usage percentage of each task is summed into the first core usage.
I can easily change that to set all of the cores to 0% - I'm not sure if that would be clear enough to indicate an error.

@LeandroMartinsdS
Copy link
Copy Markdown
Contributor Author

@JamesOHeaDLS, I think that all of your suggestions are sorted.

As I have made a few changes, would be nice to have a look again just in case I've missed something.

Thanks.

Copy link
Copy Markdown

@JamesOHeaDLS JamesOHeaDLS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I have made a couple of comments/suggestions

Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/src/pmacController.cpp Outdated
Comment thread pmacApp/Db/pmacController.template Outdated
Comment thread pmacApp/src/pmacController.cpp
@LeandroMartinsdS LeandroMartinsdS force-pushed the CPU_CoreManagement branch 2 times, most recently from 3c2294c to 5494862 Compare February 1, 2024 16:57
@LeandroMartinsdS
Copy link
Copy Markdown
Contributor Author

LeandroMartinsdS commented Apr 26, 2024

A personal reminder to change the debug level of each task frequency/time/percentage from DEBUG_TRACE to DEBUG_VARIABLE

The PowerPMAC firmware already adjusts BgDeltaTime when BgSleepTime changes

Remove repeated snippet caused by merging with conflicts
Gets the number of cores for each type of CPU.

Defines in which core the tasks are executed - for ARM arch it reads
from the controller.
It doesn't take in account Ethercat tasks.

Calculates the CPU load for each core based on the tasks defined -
maximum of 4 cores.
PR #103 sorts that in the correct way
Move debug messages to getCpuNumCores
Changed from debugf to printf as it runs only during the startup.
@LeandroMartinsdS LeandroMartinsdS merged commit 27576bf into dls-master May 14, 2024
@LeandroMartinsdS LeandroMartinsdS deleted the CPU_CoreManagement branch May 14, 2024 13:28
@LeandroMartinsdS
Copy link
Copy Markdown
Contributor Author

Tagged as 2-6-4b3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants