Skip to content
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

File descriptor usage statistics #284

Closed
giampaolo opened this issue May 23, 2014 · 5 comments
Closed

File descriptor usage statistics #284

giampaolo opened this issue May 23, 2014 · 5 comments

Comments

@giampaolo
Copy link
Owner

From tiran79 on June 15, 2012 13:44:47

Proposal  
psutil is missing a function that displays full FD usage for a process. The 
combination of get_open_files() and get_connections() doesn't list all FDs as 
psutil skips unknown types and stdin/out/err. The total amount of FDs is a very 
useful information as the amount is usually small (1024-4096) on most 
platforms. 

On what platforms would this be available?  
All 

Proposed API  
process.get_fd_usage() -> fdinfo(count=int, softlimit=int, hardlimit=int) 

Are there existent implementations we can use as an example?  
In Linux, the implementation is pretty straight forward. count = 
len(os.listdir("/proc/PID/fd"), the hard and softlimit can be acquired with 
prlimit() or from "/proc/PID/limits".

Original issue: http://code.google.com/p/psutil/issues/detail?id=284

@giampaolo
Copy link
Owner Author

From g.rodola on June 17, 2012 14:44:42

I like the idea. prlimit() is Linux only though, and I don't like returning a 
tuple which makes sense on 1 platform out of 4. We can probably add a 
get_num_fds() method returning an int (POSIX only as on Windows we already have 
get_num_handles which is similar).

@giampaolo
Copy link
Owner Author

From g.rodola on June 18, 2012 05:48:29

Implemented in r1349 , r1350 , r1351 .

Status: FixedInSVN
Labels: Milestone-0.5.0

@giampaolo
Copy link
Owner Author

From g.rodola on June 27, 2012 11:54:03

0.5.0 is finally out. Closing out as fixed.

Status: Fixed

@giampaolo
Copy link
Owner Author

From tiran79 on June 27, 2012 14:47:16

Thanks! Your implementation is more than sufficient for my needs. The idea with 
hard and soft limit was more like gimmick. I just need the information for the 
current Linux process so I can use the resource module.

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:09:19

Updated csets after the SVN -> Mercurial migration: r1349 == revision ???

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

No branches or pull requests

1 participant