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
Is there a way to collect the real-time network speed of each process and the total traffic of each process? #2131
Comments
Can you define "real-time network speed"? To avoid an XY problem, what is the actual goal of obtaining this data?
What exactly do you want to monitor? And why? There are at least 3 major GPU manufacturers and each of them has their own highly specialized software providing a lot more information than a cross-platform program trying to generalize statistics across multiple hardware vendors could even hope to achieve. |
Thank you very much for your reply. I actually want to express the following two meanings:
|
Hey @LRF520, before I provide some more commentary, I first want to point out that I am not a maintainer at this project and have limited python and C skills. I maintain a Java-based project similar to this one so there is a very large overlap in how both projects fetch native information, so this answer is more from the perspective of "what is available from the OS" than any intention to add information here. The general answer to both questions is "it can be done but it is very hard to do and there already exist better tools to do this than anything we could cobble together." Network StatisticsBased on your screen capture I'm assuming you mean bandwidth/usage, rather than speed. The problem we have is that to have that generally available we have to actively monitor every connection on the system.
I could go on, but at this point hopefully you see that monitoring every process and every network connection is an incredibly wasteful use of CPU compared to waiting until you actually have a network issue and then troubleshooting using a utility program already built in to these OS's. Thus my original question about XY problem. Do you really want to monitor every process and every network connection on the system? Or do you just want to identify problems when they occur? The answers are going to be different. GPU usageWhile most OS's provide at least some kernel-level support for network ports, the same can not be said for GPU. There is no standard API by which this information is available, primarily because there are multiple GPU vendors (NVidia, AMD, ASUS, Intel, etc.). They each have different software using highly specialized drivers associated with their proprietary cards. The best a cross-platform program like psutil can do is try to parse the command-line output of these cards' own command-line software. See for example the gpustat project in python. That's a whole lot of code for only a portion of GPU in one operating system. Windows 10+ has a performance counter that you can get GPU "ticks" similar to CPU usage but you'd need to run a daemon to collect these over time to calculate percentages. macOS has the best support here, actually giving a percentage number in the IO Registry (it helps to control your own hardware!) but the names have changed across macOS versions so trying to implement that here would mean trial and error across a range of different registry keys until one worked. SummaryIt's hard to do both of these things and there are ample specialized tools out there that give far better, more detailed, and useful information than psutil could ever hope to provide. In the case of bandwidth, often we don't care unless there's a problem and then you can troubleshoot the problem. In the case of GPU, different vendors and specialized drivers for their hardware make it impractical to try to cover every possibility on every operating system. |
Thank you very much for sharing your experience. I believe this set of tools will become better and better. |
Hello, I've tried for a long time but haven't solved it. I want to ask two questions:
(1)Is there a way to collect the real-time network speed of each process and the total traffic of each process?
(2)Is there a plan for GPU monitoring?
The text was updated successfully, but these errors were encountered: