I have RHEL , which I need to put under a moderate and variable processor load (50% -75%).
What is the best way to do this? Is there a program that can do this that I don’t know about? I am happy to write C code for this to happen, I just don’t know which system calls will help.
This is exactly what you need: http://weather.ou.edu/~apw/projects/stress/
On the home page: “stress is a simple POSIX workload generator that imposes a configurable amount of CPU, memory, I / O, and disk voltage onto the system. It is written in C and is free software licensed under the GPL license.”
Find a simple source code prime program. Modify the source code to add a bothersome call to the main loop, depending on what kind of delay gives you the desired processor load.
. - Linux.
, tar.bz2, , /boot .config zcat/proc/config.gz > .config, make oldconfig, true; && bzImage;
SMP-, make -j bzImage - , .
. , .
, . , . RAID- , Bonnie ++ IOZone. IOZone , , .
.
, Bash script. "ps -o pcpu | grep -v CPU", CPU . , . , , , . , , , .
CPU Monitor script , .
, - script , nice renice, , .
renice
bash script, :
#!/bin/bash while true ; do true done
"nice".
a) : $ nice -n -20 my_command
b) : $ nice -n 20 my_command
script awk. script , , , passwd loaderver.sh.
script @ http://unixfoo.blogspot.com/2008/11/linux-cpu-hammer-script.html
Lookbusy .
lookbusy -c util[-high_util], --cpu-util util[-high_util] i.e. 60% load lookbusy -c 60
, . , glxgears 100% .
, - , , , CPU 100%.
(0 1 2 3), " ", CPU 0 1. 50%. , 75% 0 1 2 .
: . . , , ?