Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2009 Doug Hellmann All rights reserved.
  5. #
  6. """
  7. """
  8. #end_pymotw_header
  9.  
  10. import resource
  11.  
  12. print 'Resource limits (soft/hard):'
  13. for name, desc in [
  14. ('RLIMIT_CORE', 'core file size'),
  15. ('RLIMIT_CPU', 'CPU time'),
  16. ('RLIMIT_FSIZE', 'file size'),
  17. ('RLIMIT_DATA', 'heap size'),
  18. ('RLIMIT_STACK', 'stack size'),
  19. ('RLIMIT_RSS', 'resident set size'),
  20. ('RLIMIT_NPROC', 'number of processes'),
  21. ('RLIMIT_NOFILE', 'number of open files'),
  22. ('RLIMIT_MEMLOCK', 'lockable memory address'),
  23. ]:
  24. limit_num = getattr(resource, name)
  25. soft, hard = resource.getrlimit(limit_num)
  26. print '%-23s %s / %s' % (desc, soft, hard)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement