Operating System - HP-UX
1825766 Members
2045 Online
109687 Solutions
New Discussion

Wants to make a machine 100% CPU usage for 6 minutes...

 
SOLVED
Go to solution
Silver_1
Regular Advisor

Wants to make a machine 100% CPU usage for 6 minutes...

Hi,

I want to test some alerts on a machine.

I need to achieve this, 100 % CPU for more than 6 minutes.

How can i achieve this.

Any help is appeciated.....

Tx,
Nair.
6 REPLIES 6
Pete Randall
Outstanding Contributor
Solution

Re: Wants to make a machine 100% CPU usage for 6 minutes...

See this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=998254

Bill's response is the better way to do it.


Pete

Pete
Kent Ostby
Honored Contributor

Re: Wants to make a machine 100% CPU usage for 6 minutes...

There are multiple ways to do this.

Write a script that kicks off multiple scripts that have tight loops in them.

2x scripts per CPU on the box should lock it up pretty well.

You could also consider giving them higher priorities than standard processes to increase the likelihood they will chew up the CPU.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
A. Clay Stephenson
Acclaimed Contributor

Re: Wants to make a machine 100% CPU usage for 6 minutes...

I would do it like this :

loop 360 &
loop 360 &
loop 360 &
loop 360 &

This is a very tight C program that loops until the number of seconds sent in on the command line expires. Drop a few of these on a box and it will grab everything but no interaction is needed to kill them.
I've intentionally do this in K&R C so that the Bunlled C Compiler will handle it. If you like, you can covert it to ANSI C in about 20 seconds.

Compile like this:

cc loop.c -o loop
If it ain't broke, I can fix that.
Silver_1
Regular Advisor

Re: Wants to make a machine 100% CPU usage for 6 minutes...

Thanks for your help. I am able to make 100% CPU usage.
James R. Ferguson
Acclaimed Contributor

Re: Wants to make a machine 100% CPU usage for 6 minutes...

Hi Nair:

# perl -e 'alarm 360;while (1) {}'

Regards!

...JRF...
rick jones
Honored Contributor

Re: Wants to make a machine 100% CPU usage for 6 minutes...

I would run as many loopback netperf TCP_STREAM tests as there were CPUs in the system. This will load the CPU with both user and kernel time and will increase the networking statistics for the loopback interface.

Another option if your network's don't mind would be to run a number of UDP_STREAM tests from the system - as many as CPUs - pointing at some poor system out on the net. That will also take each CPU to 100% and increment "real" network statistics.

However, I'd probably not do the latter on a production system.

http://www.netperf.org/
there is no rest for the wicked yet the virtuous have no pillows