Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # encoding: utf-8
- #
- # Copyright (c) 2009 Doug Hellmann All rights reserved.
- #
- """
- """
- #end_pymotw_header
- import resource
- print 'Resource limits (soft/hard):'
- for name, desc in [
- ('RLIMIT_CORE', 'core file size'),
- ('RLIMIT_CPU', 'CPU time'),
- ('RLIMIT_FSIZE', 'file size'),
- ('RLIMIT_DATA', 'heap size'),
- ('RLIMIT_STACK', 'stack size'),
- ('RLIMIT_RSS', 'resident set size'),
- ('RLIMIT_NPROC', 'number of processes'),
- ('RLIMIT_NOFILE', 'number of open files'),
- ('RLIMIT_MEMLOCK', 'lockable memory address'),
- ]:
- limit_num = getattr(resource, name)
- soft, hard = resource.getrlimit(limit_num)
- print '%-23s %s / %s' % (desc, soft, hard)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement