giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.31k stars 1.39k forks source link

[Linux] batch multiple process info in one shot #2454

Open giampaolo opened 1 month ago

giampaolo commented 1 month ago

This is a reminder ticket to investigate some links that @iglendd shared in https://github.com/giampaolo/psutil/issues/2366:

I didn't investigate any of these links, so I'm not sure if this is even possible, but more or less the idea here is to fetch info about multiple process in one shot, and integrate this in psutil.process_iter(). Or to put it another way, there may (or rather will) be an alternative method to reading pseudo-files from /proc, which is quite expensive on Linux (in fact it may be the slowest implementation across all supported platforms).

iglendd commented 1 month ago

@giampaolo I did investigate it a bit after I have shared with you. It appears that in theory there are a few alternative methods had been discussed a while ago but I think they have never materialized in the main Linux releases (despite the obvious shortcomings in the /proc API calls). I could be wrong but that is my impression. :(.