Simulate System Loads
Sysadmins often need to discover how the performance of an application is affected when the system is under certain types of load. This means that an artificial load must be re-created. It is, of course, possible to install dedicated tools to do this but this option isn’t always desirable or possible.

Every Linux distribution comes with all the tools needed to create load. They are not as configurable as dedicated tools but they will always be present and you already know how to use them.

CPU
The following command will generate a CPU load by compressing a stream of random data and then sending it to /dev/null:

cat /dev/urandom | gzip -9 > /dev/null
If you require a greater load or have a multi-core system simply keep compressing and decompressing the data as many times as you need e.g.:

cat /dev/urandom | gzip -9 | gzip -d | gzip -9 | gzip -d > /dev/null
An alternative is to use the sha512sum utility:

sha512sum /dev/urandom
Use CTRL+C to end the process.

RAM
The following process will reduce the amount of free RAM. It does this by creating a file system in RAM and then writing files to it. You can use up as much RAM as you need to by simply writing more files.

First, create a mount point then mount a ramfs filesystem there:

mkdir z
mount -t ramfs ramfs z/
Then, use dd to create a file under that directory. Here a 128MB file is created:

dd if=/dev/zero of=z/file bs=1M count=128
The size of the file can be set by changing the following operands:

bs= Block Size. This can be set to any number followed B for bytes, K for kilobytes, M for megabytes or G for gigabytes.
count= The number of blocks to write.
Disk
We will create disk I/O by firstly creating a file, and then use a for loop to repeatedly copy it.

This command uses dd to generate a 1GB file of zeros:

dd if=/dev/zero of=loadfile bs=1M count=1024
The following command starts a for loop that runs 10 times. Each time it runs it will copy loadfile over loadfile1:

for i in {1..10}; do cp loadfile loadfile1; done
If you want it to run for a longer or shorter time change the second number in {1..10}.

If you prefer the process to run forever until you kill it with CTRL+C use the following command:

while true; do cp loadfile loadfile1; done

posted @ 2021-03-30 17:48 喝姜水涂风油精 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 调整更新频率: sudo powertop --time=x sedonds 输出csv文件: sudo powertop --csv=x.csv 输出html文件: sudo powertop --html=x.html c0~c7对应cpu7个状态,其中c0是全速工作,c1~c7对应不同程度的节 阅读全文
posted @ 2021-03-30 16:53 喝姜水涂风油精 阅读(184) 评论(0) 推荐(0) 编辑
摘要: $conda activate $conda deactivate 阅读全文
posted @ 2019-02-24 12:10 喝姜水涂风油精 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 综合上述两个帖子: https://www.cnblogs.com/huadongw/p/6161145.html https://blog.csdn.net/u011587516/article/details/78995186 先把之前安装的xgboost都卸载干净: pip uninstall 阅读全文
posted @ 2019-02-24 11:57 喝姜水涂风油精 阅读(1351) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/Super_jm_/article/details/81947563 使用pip安装文件时候提示 ImportError: No module named setuptools 用一句命令就可以解决 sudo apt-get install python- 阅读全文
posted @ 2019-02-24 00:06 喝姜水涂风油精 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 转自https://blog.csdn.net/qq_37935670/article/details/80377196 2.显卡驱动配置 网上有些攻略非常非常复杂,又要禁用nouveau驱动,又要进入控制台,又要加载源什么什么的。发现高了半天,网卡驱动还是没装上去,系统重装了好几遍。 其实很简单, 阅读全文
posted @ 2019-02-23 21:14 喝姜水涂风油精 阅读(622) 评论(0) 推荐(0) 编辑
摘要: import torch torch中的squeeze与unsqueeze作用是去除/添加维度为1的行 例如,a=torch.randn(2,3) 那么b=a.unsqueeze(0),b为(1,2,3)的矩阵 类似的,b=a.unsqueeze(1),b为(2,1,3)的矩阵 b=a.unsque 阅读全文
posted @ 2019-02-14 16:42 喝姜水涂风油精 阅读(594) 评论(0) 推荐(0) 编辑
摘要: 最简单的方法是使用一个字符串流(stringstream):#include<iostream>#include<string>#include<sstream>using namespace std;string itos(int i) // 将int 转换成string{ stringstrea 阅读全文
posted @ 2018-05-11 12:40 喝姜水涂风油精 阅读(1367) 评论(0) 推荐(0) 编辑
摘要: 1,如果查文章是不是被SCI检索:进入ISI Web of Knowledge,选择Web of Science 数据库,进行查询;2,如果查文章是不是被EI检索:进入EI Village, 选择Compendex 数据库,进行查询。 阅读全文
posted @ 2018-04-23 16:38 喝姜水涂风油精 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 终端输入:wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb sudo apt-get install gdebi sudo gdebi AdbeRdr9.5.5- 阅读全文
posted @ 2018-04-21 10:58 喝姜水涂风油精 阅读(128) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示