python resource 模块
来源:互联网 发布:mac复制到u盘 编辑:程序博客网 时间:2024/05/16 16:11
(只用于 Unix , 可选) resource
模块用于查询或修改当前系统资源限制设置. Example 12-10 展示了如何执行查询操作, Example 12-11 展示了如何执行修改操作
Example 12-10. 使用 resource 模块查询当前设置
import resourceprint "usage stats", "=>", resource.getrusage(resource.RUSAGE_SELF)print "max cpu", "=>", resource.getrlimit(resource.RLIMIT_CPU)print "max data", "=>", resource.getrlimit(resource.RLIMIT_DATA)print "max processes", "=>", resource.getrlimit(resource.RLIMIT_NPROC)print "page size", "=>", resource.getpagesize()
usage stats => (0.03, 0.02, 0, 0, 0, 0, 75, 168, 0, 0, 0, 0, 0, 0, 0, 0)max cpu => (2147483647, 2147483647)max data => (2147483647, 2147483647)max processes => (256, 256)page size => 4096
Example 12-11. 使用 resource 模块限制资源
File: resource-example-2.pyimport resourceresource.setrlimit(resource.RLIMIT_CPU, (0, 1))# pretend we're busyfor i in range(1000): for j in range(1000): for k in range(1000): pass
CPU time limit exceeded
- python resource 模块
- Python Resource
- Python Resource
- Python Resource
- Spring 资源Resource 模块
- angular $resource模块
- angular $resource模块
- angular $resource模块
- angular $resource模块
- 【python】Resource temporarily unavailable
- python模块 ---logging模块
- python模块-re模块
- python模块 - functools模块
- python 模块 模块文件
- python模块 - pickle模块
- python模块 - copy模块
- python模块
- python 模块
- POJ 2187 Beauty Contest(旋转卡壳求点凸包直径)
- Oracle中的开锁和解锁
- 测试中对linux shell的使用
- 一名刚毕业的嵌入式从业者
- 服务级后门自己做——创建服务
- python resource 模块
- 建立远程连接
- Android-关于屏幕适配的一些经验
- POJ 2080 Calender
- Pieces
- Linux查看操作系统位数、CPU架构、个数、核数
- JQuery获取元素的实际高度
- SocketEngine Index=1 RouniID=1150
- 软件项目开发流程