How to set processor load in a Red Hat Linux box?

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.

+5
source share
10 answers

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.”

+15
source

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.

+2
source

. - Linux.

, tar.bz2, , /boot .config zcat/proc/config.gz > .config, make oldconfig, true; && bzImage;

SMP-, make -j bzImage - , .

. , .

+1

, . , . RAID- , Bonnie ++ IOZone. IOZone , , .

.

+1

, Bash script. "ps -o pcpu | grep -v CPU", CPU . , . , , , . , , , .

CPU Monitor script , .

+1

, - script , nice renice, , .

bash script, :

#!/bin/bash
while true ; do
true
done
0

"nice".

a) : $ nice -n -20 my_command

b) : $ nice -n 20 my_command

0

script awk. script , , , passwd loaderver.sh.

script @ http://unixfoo.blogspot.com/2008/11/linux-cpu-hammer-script.html

0

Lookbusy .

lookbusy -c util[-high_util], --cpu-util util[-high_util]

i.e. 60% load
lookbusy -c 60
0

, . , glxgears 100% .

, - , , , CPU 100%.

(0 1 2 3), " ", CPU 0 1. 50%. , 75% 0 1 2 .

: . . , , ?

-1

All Articles