搜索到下面文章
Linux 压测工具 stress 安装下载使用_ junior1206的博客-CSDN博客_stress下载stress是一个linux下的压力测试工具,专门为那些想要测试自己的系统,完全高负荷和监督这些设备运行的用户。第一种下载地址http://people.seas.harvard.edu/~apw/stress/将stress-1.0.4.tar.gz复制到“/etc/local/src/”目录下:执行以下命令安装:Step1 #cd /usr/local/srcS...https://blog.csdn.net/cojn52/article/details/89680093 通过下载地址进行下载
https://fossies.org/linux/privat/stress-1.0.4.tar.gz/https://fossies.org/linux/privat/stress-1.0.4.tar.gz/ 我下载时已经有新的本版了,但是我还不敢试验新的,我下载的还是1.0.4版本,具体操作如下
或者直接通过下面地址进行下载
百度网盘 请输入提取码https://pan.baidu.com/s/1Vkrg_vdPkxgjdfxg0RaDHg提取码:ywlw
?根据文章提示要把下载的文件放在/usr/local/src/,但是我通过本机拖不过去于是我先放在了/tmp/下
通过”mv“进行移动继续解压操作
[root@localhost tmp]# mv stress-1.0.4.tar.gz /usr/local/src
[root@localhost tmp]# cd /usr/local/src/
[root@localhost src]# tar -xzpvf stress-1.0.4.tar.gz
压缩解压命令可以参考下面文章
linux下解压命令大全_饮水思源09的博客-CSDN博客_linux解压命令https://blog.csdn.net/xsfqh/article/details/89448976但是在执行后续操作时遇到了问题
[root@localhost src]# cd stress-1.0.4
[root@localhost stress-1.0.4]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/stress-1.0.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
[root@localhost stress-1.0.4]# make
bash: make: command not found...
Install package 'make' to provide command 'make'? [N/y] y
* Waiting in queue...
The following packages have to be installed:
make-1:4.2.1-11.el8.x86_64 A GNU tool which simplifies the build process for users
Proceed with changes? [N/y] y
* Waiting in queue...
* Waiting for authentication...
* Waiting in queue...
* Downloading packages...
* Requesting data...
* Testing changes...
* Installing packages...
make: *** No targets specified and no makefile found. Stop.
[root@localhost stress-1.0.4]# make check
make: *** No rule to make target 'check'. Stop.
[root@localhost stress-1.0.4]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/stress-1.0.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
先解决第一个问题,通过搜索
取下面文章的解决办法
(35条消息) no acceptable C compiler found in $PATH_JAVA-LPF的博客-CSDN博客https://blog.csdn.net/IT_LPF/article/details/107360501
[root@localhost stress-1.0.4]# yum -y install gcc-c++
---安装内容不显示
[root@localhost stress-1.0.4]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC)
[root@localhost stress-1.0.4]#
[root@localhost src]# ./configure
-bash: ./configure: No such file or directory
[root@localhost src]# cd /s
sbin/ srv/ sys/
[root@localhost src]# cd stress-1.0.4/
[root@localhost stress-1.0.4]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... none
checking dependency style of gcc... none
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for unistd.h... (cached) yes
checking for sqrt in -lm... yes
checking for basename in -lgen... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating test/Makefile
config.status: executing depfiles commands
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]# make
bash: make: command not found...
Install package 'make' to provide command 'make'? [N/y] y
* Waiting in queue...
* Loading list of packages....
The following packages have to be installed:
make-1:4.2.1-11.el8.x86_64 A GNU tool which simplifies the build process for users
Proceed with changes? [N/y] y
* Waiting in queue...
* Waiting for authentication...
* Waiting in queue...
* Downloading packages...
* Requesting data...
* Testing changes...
* Installing packages...
Making all in .
make[1]: Entering directory '/usr/local/src/stress-1.0.4'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4'
Making all in src
make[1]: Entering directory '/usr/local/src/stress-1.0.4/src'
source='stress.c' object='stress.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../depcomp \
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"stress\" -DVERSION=\"1.0.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBM=1 -I. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -O2 -c stress.c
gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -O2 -o stress stress.o -lm
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/src'
Making all in doc
make[1]: Entering directory '/usr/local/src/stress-1.0.4/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
Making all in test
make[1]: Entering directory '/usr/local/src/stress-1.0.4/test'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/test'
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]# make
Making all in .
make[1]: Entering directory '/usr/local/src/stress-1.0.4'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4'
Making all in src
make[1]: Entering directory '/usr/local/src/stress-1.0.4/src'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/src'
Making all in doc
make[1]: Entering directory '/usr/local/src/stress-1.0.4/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
Making all in test
make[1]: Entering directory '/usr/local/src/stress-1.0.4/test'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/test'
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]# make check
Making check in .
make[1]: Entering directory '/usr/local/src/stress-1.0.4'
make[1]: Nothing to be done for 'check-am'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4'
Making check in src
make[1]: Entering directory '/usr/local/src/stress-1.0.4/src'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/src'
Making check in doc
make[1]: Entering directory '/usr/local/src/stress-1.0.4/doc'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
Making check in test
make[1]: Entering directory '/usr/local/src/stress-1.0.4/test'
make check-TESTS
make[2]: Entering directory '/usr/local/src/stress-1.0.4/test'
++ ../src/stress --version
stress 1.0.4
PASS: check_version_return_code
`stress' imposes certain types of compute stress on your system
Usage: stress [OPTION [ARG]] ...
-?, --help show this help statement
--version show version statement
-v, --verbose be verbose
-q, --quiet be quiet
-n, --dry-run show what would have been done
-t, --timeout N timeout after N seconds
--backoff N wait factor of N microseconds before work starts
-c, --cpu N spawn N workers spinning on sqrt()
-i, --io N spawn N workers spinning on sync()
-m, --vm N spawn N workers spinning on malloc()/free()
--vm-bytes B malloc B bytes per vm worker (default is 256MB)
--vm-stride B touch a byte every B bytes (default is 4096)
--vm-hang N sleep N secs before free (default none, 0 is inf)
--vm-keep redirty memory instead of freeing and reallocating
-d, --hdd N spawn N workers spinning on write()/unlink()
--hdd-bytes B write B bytes per hdd worker (default is 1GB)
Example: stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).
PASS: check_usage_return_code
==================
All 2 tests passed
==================
make[2]: Leaving directory '/usr/local/src/stress-1.0.4/test'
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/test'
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]# make install
Making install in .
make[1]: Entering directory '/usr/local/src/stress-1.0.4'
make[2]: Entering directory '/usr/local/src/stress-1.0.4'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/usr/local/src/stress-1.0.4'
make[1]: Leaving directory '/usr/local/src/stress-1.0.4'
Making install in src
make[1]: Entering directory '/usr/local/src/stress-1.0.4/src'
make[2]: Entering directory '/usr/local/src/stress-1.0.4/src'
test -z "/usr/local/bin" || /usr/bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c 'stress' '/usr/local/bin/stress'
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/usr/local/src/stress-1.0.4/src'
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/src'
Making install in doc
make[1]: Entering directory '/usr/local/src/stress-1.0.4/doc'
make[2]: Entering directory '/usr/local/src/stress-1.0.4/doc'
make[2]: Nothing to be done for 'install-exec-am'.
test -z "/usr/local/share/info" || /usr/bin/mkdir -p "/usr/local/share/info"
/usr/bin/install -c -m 644 './stress.info' '/usr/local/share/info/stress.info'
install-info --info-dir='/usr/local/share/info' '/usr/local/share/info/stress.info'
test -z "/usr/local/share/man/man1" || /usr/bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 'stress.1' '/usr/local/share/man/man1/stress.1'
make[2]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
Making install in test
make[1]: Entering directory '/usr/local/src/stress-1.0.4/test'
make[2]: Entering directory '/usr/local/src/stress-1.0.4/test'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/usr/local/src/stress-1.0.4/test'
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/test'
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]#
[root@localhost stress-1.0.4]# make clean
Making clean in test
make[1]: Entering directory '/usr/local/src/stress-1.0.4/test'
make[1]: Nothing to be done for 'clean'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/test'
Making clean in doc
make[1]: Entering directory '/usr/local/src/stress-1.0.4/doc'
rm -rf stress.aux stress.cp stress.cps stress.fn stress.fns stress.ky \
stress.kys stress.log stress.pg stress.tmp stress.toc \
stress.tp stress.tps stress.vr stress.vrs stress.dvi \
stress.pdf stress.ps stress.html
rm -f vti.tmp
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/doc'
Making clean in src
make[1]: Entering directory '/usr/local/src/stress-1.0.4/src'
test -z "stress" || rm -f stress
rm -f *.o
make[1]: Leaving directory '/usr/local/src/stress-1.0.4/src'
Making clean in .
make[1]: Entering directory '/usr/local/src/stress-1.0.4'
make[1]: Nothing to be done for 'clean-am'.
make[1]: Leaving directory '/usr/local/src/stress-1.0.4'
[root@localhost stress-1.0.4]#
第一个终端运行 stress 命令,模拟一个 CPU 使用率 100% 的场景:?
??
stress --cpu 1 --timeout 600
第二个终端运行 uptime 查看平均负载的变化情况:
watch -d uptime
第三个使用top命令查看cpu使用情况:
第第四个终端运行 mpstat 查看 CPU 使用率的变化情况(这里需要下载)
?# -P ALL 表示监控所有 CPU,后面数字 5 表示间隔 5 秒后输出一组数据
mpstat -P ALL 5
|