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
frequency of reading process times & read process times without pid #1670
Comments
Not sure what you mean.
Again, not sure what you mean. If the PID changes every time you have to instantiate a new process instance. |
Rephrasing first question, in what frequency is the execution time recording recommended and does it have a high overhead on the processor to run this function? Rephrasing the second question, Can I record cpu_times() of a process using the process name somehow instead of the pid? |
I'm not sure what you mean but everything I know about
No.
Search the process by name first: |
Okay, Thanks for the answer. I understand the second one perfectly now. What I was trying to say in the first one is, Is running the function "cpu_times()" periodically on a python script going to consume a significant amount of cpu-resources? I am guessing from your previous answer that it is not. |
I have two questions:
what is the maximum frequency of data collection using psutil.cpu_times() ?
how can I use psutil.cpu_times() without specifying pid everytime I run it as I need to read cpu times and percentage for a sincle process. Currently I use it like this but I need to change the pid everytime I run the process of interest as it keeps changing with each startup.
p = psutil.Process(<pid_number>)
times=p.cpu_times()
The text was updated successfully, but these errors were encountered: