Operating System - HP-UX
1752569 Members
4871 Online
108788 Solutions
New Discussion юеВ

How to we generate load on CPU

 
SOLVED
Go to solution
chindi
Respected Contributor

How to we generate load on CPU

We have a test server , weneed to test Nagios tool .

We would like to generate load on HPUX 11iv3 OS , rx2800i4 , let me know how do we achieve the same ?

3 REPLIES 3
chindi
Respected Contributor

Re: How to we generate load on CPU

Got this Infor from James old post ;

 

For creating a CPU load that stops after 60-seconds:

# perl -e '$SIG{ALRM}=sub {exit};alarm 60;1 while {}'

...change the value of 'alarm 60' according to your tastes.

For allocating some memory and sleeping for some period thereafter:

# perl -e '$sz=$ARGV[0] ||1_000_000;@a=1..$sz;sleep 30'

...You may need to adjuct the default allocation of 1,000,000 characters depending upon your kernel parameters. You can pass any value you want, too:

# perl -e '$sz=$ARGV[0] ||1_000_000;@a=1..$sz;sleep 30' 50000

...means allocate a string of 50,000 characters instead of the default 1,000,000.

As for I/O, use the classic one:

# dd if=/dev/rdsk/c2t0d0 of=/dev/null bs=256k count=1000

...vary the count parameter to vary the amount of time doing I/O.

 

Thanks James :-)

Bill Hassell
Honored Contributor
Solution

Re: How to we generate load on CPU

Attached is a script that generates 1 or more 100% CPU load processes. There's no limits imposed so you can start 2 processes or 100 processes, each one consuming 100% CPU usage and shared CPU usage when the load exceeds the number of CPUs. Works on HP-UX, Linux, AIX and Solaris. Uses ksh so AIX might need ksh loaded or switch the interpreter line to bash. Use sar, top or Glance to see what is happening.



Bill Hassell, sysadmin
chindi
Respected Contributor

Re: How to we generate load on CPU

Thanks a ton Bill