-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add CPU percentage of processes to the measurements #13
Comments
This is actually very useful, since it can track full utilization of the
CPU.
Would recommend adding an option to divide by the number of CPU cores.
This would then provide a percent utilization of the whole CPU across all
cores.
…On Tue, Mar 26, 2024 at 10:58 AM Erik Huckvale ***@***.***> wrote:
This may not be as helpful information when child processes are used
without showing the information for the main and child processes
individually as described in #11
<#11>. But
the user can decide whether they want to see just the sum of all CPU
percentages or that in addition to the more granular version. This stack
overflow
<https://stackoverflow.com/questions/41206809/psutil-measuring-the-cpu-usage-of-a-specific-process>
describes how this can be accomplished. We should explain in the
documentation that a cpu usage of greater than 100% can occur if a process
uses multiple threads across multiple cores.
—
Reply to this email directly, view it on GitHub
<#13>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEP7BZ4I5QSUM5LQTIK6TDY2GEJLAVCNFSM6AAAAABFJDJDNSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYDQNJQGA3TKMY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Hunter Moseley, Ph.D. -- Univ. of Kentucky
Professor, Dept. of Molec. & Cell. Biochemistry / Markey Cancer Center
/ Institute for Biomedical Informatics / UK Superfund Research Center
Not just a scientist, but a fencer as well.
My foil is sharp, but my mind sharper still.
---------------------------------------------------------------
Email: ***@***.*** (work) ***@***.***
(personal)
Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax)
Web: http://bioinformatics.cesb.uky.edu/
Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093
|
Possible data class
|
If the information is across CPU cores, then I would recommend the following key names: |
Just realized one more important aspect of reporting CPU utilization. |
|
A CPU has multiple CPU cores.
So, core_percent is in place of cpu_percent.
And cpu_percent is in place of normalized_cpu_percent.
Yes, you can rename the class to CPUUtilization.
Yes, use max_ and mean_ to distinguish between max and mean values.
…On Wed, Apr 10, 2024 at 6:04 PM Erik Huckvale ***@***.***> wrote:
@hunter-moseley <https://github.com/hunter-moseley>
1. What is the difference between cpu_percent and core_percent?
2. To account for collecting the average, should we rename the class
to just CPUUtilization? And should we name the fields as so:
system_max_core_percent, system_mean_core_percent,
main_max_core_percent, main_mean_core_percent, etc.
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEP7B7FNBNGX5KID3ELM4DY4WZP5AVCNFSM6AAAAABFJDJDNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGUYTINZQGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Hunter Moseley, Ph.D. -- Univ. of Kentucky
Professor, Dept. of Molec. & Cell. Biochemistry / Markey Cancer Center
/ Institute for Biomedical Informatics / UK Superfund Research Center
Not just a scientist, but a fencer as well.
My foil is sharp, but my mind sharper still.
---------------------------------------------------------------
Email: ***@***.*** (work) ***@***.***
(personal)
Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax)
Web: http://bioinformatics.cesb.uky.edu/
Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093
|
@hunter-moseley I did an experiment and it is strongly evident that |
Use sum.
…On Wed, Apr 10, 2024, 6:56 PM Erik Huckvale ***@***.***> wrote:
@hunter-moseley <https://github.com/hunter-moseley> I did an experiment
and it is strongly evident that psutil.cpu_percent() is the same as
numpy.mean(psutil.cpu_percent(percpu=True)). In other words, the mean
percentage across all available CPUs. As I understand it, that would be the
value for system_cpu_percent. So the question is, how would we like to
calculate the value for system_core_percent? I'd think that would be the
sum of all the core percentages as opposed to the mean? If that isn't very
meaningful (perhaps because the value would possibly be more dependent on
the number of cores in the system than anything else), we could
alternatively exclude system_core_percent.
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEP7BY6N4PRF3GAY24YYV3Y4W7S5AVCNFSM6AAAAABFJDJDNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGU3DMMJTGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
So the final implementation should be?
|
This looks complete.
…On Wed, Apr 10, 2024, 7:26 PM Erik Huckvale ***@***.***> wrote:
So the final implementation should be?
@dclass.dataclass
class CPUUtilization:
system_core_count: int
system_max_core_percent: float = 0.
system_max_cpu_percent: float = 0.
main_max_core_percent: float = 0.
main_max_cpu_percent: float = 0.
descendent_max_core_percent: float = 0.
descendent_max_cpu_percent: float = 0.
combined_max_core_percent: float = 0.
combined_max_cpu_percent: float = 0.
system_mean_cpu_percent: float = 0.
system_mean_core_percent: float = 0.
main_mean_core_percent: float = 0.
main_mean_cpu_percent: float = 0.
descendent_mean_core_percent: float = 0.
descendent_mean_cpu_percent: float = 0.
combined_mean_core_percent: float = 0.
combined_mean_cpu_percent: float = 0.
main_n_threads: int = 0
descendant_n_threads: int = 0
combined_n_threads: int = 0
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADEP7B4UUCA5AJT76VVLHMDY4XDEBAVCNFSM6AAAAABFJDJDNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGU4TIOJYGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Fixed by #30 |
This may not be as helpful information when child processes are used without showing the information for the main and child processes individually as described in #11. But the user can decide whether they want to see just the sum of all CPU percentages or that in addition to the more granular version. This stack overflow describes how this can be accomplished. We should explain in the documentation that a cpu usage of greater than 100% can occur if a process uses multiple threads across multiple cores.
The text was updated successfully, but these errors were encountered: