从python调用stress和/或stress ng的简单程序
stressyp的Python项目详细描述
stressypy使用unix包stress对一定数量的cpu施加一定的压力 用户指定的时间。它创建JobBlock对象,这些对象包含使用这些对象的相关信息 测试排队算法的压力负载。
作业块属性:
jobblock类用于存储任何函数及其cpu宽度和时间高度。
实例属性
- n_CPU:受压力的CPU数量
- t_run:运行作业所需的时间
- func:块存储的函数
- func_args:块存储的函数的参数
- 作业:func和arg的组合,返回块应执行的完整作业
attribute type | description |
---|---|
input | n_cpu: number of cpus being stressed |
input | t_run: the time it will take to run the job |
set with set_job() | func: the function the block is storing |
set with set_job() | func_args: the arguments for the function the block is storing |
calculated | job: a combination of the func and arg to return the complete job that the block should execute |
安装
stressypy可以与pip install stressypy一起安装
或手动克隆并使用python setup.py install
设置stressypy依赖于stressunix包。确保安装了它。
Unix Distro | Command |
---|---|
Debian | sudo apt-get install stress |
Arch Linux | pacman -S stress |
方向
stressypy使用命令stressy stress运行,并将CPU数量和时间作为参数传递
- stressy stress 1 1持续1秒强调一个核心
- stressy stress 7 3应力7核3秒