1753955 Members
7496 Online
108811 Solutions
New Discussion юеВ

Re: small script

 
SOLVED
Go to solution
John Dvorchak
Honored Contributor

small script

I have looked all over but I can't seem to find a script that would spike a CPU and/or disk I/O for a class I am trying to teach. I am trying to get some new to UNIX folks used to looking for runaway processes and to demonstrate the effects of tuning the file systems.

No big deal and please don't spend much time on this. Prefer ksh or real easy C compile or if there is a perl. I just have to run it on HPUX 11.x and Sun 8, 9 or 10.
If it has wheels or a skirt, you can't afford it.
6 REPLIES 6
Paul Sperry
Honored Contributor

Re: small script

well you can use stm or xstm to exersize your disks, memory, and CPU's in HPUX
not sure about Sun
James R. Ferguson
Acclaimed Contributor
Solution

Re: small script

Hi John:

For running a CPU at 100% for 120-seconds:

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

...this will automatically stop after 120-seconds. Adjust to your taste.

For doing I/O, chose a disk device and do:

# dd if=/dev/rdsk/cXtYdZ of=/dev/null bs=64k

...kill with ^C when you are satisfied.

Regards!

...JRF...
John Dvorchak
Honored Contributor

Re: small script

Thanks for the info, but I already know about STM for exercising the cpu etc. I was looking for a generic script that I can use on multiple OS's.
If it has wheels or a skirt, you can't afford it.
Ivan Ferreira
Honored Contributor

Re: small script

The yes command is very cpu intensive and it's available on all UNIX versions.

The dd command is a good one to generate I/O.

Starting backup operations are also good cpu/memory/disk excersicers.

Check this link also:

http://www.acnc.com/benchmarks.html
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
John Dvorchak
Honored Contributor

Re: small script

All of these are good, but so far the yes command shows the highest on both HPUX and Solaris 10.
If it has wheels or a skirt, you can't afford it.
Bill Hassell
Honored Contributor

Re: small script

Works on any POSIX shell to create 100% CPU (also the shortest script I could find):

while :
do
:
done

Run this in the background once for each CPU to saturate everything, then run additional copies to show timeshare context switches.


Bill Hassell, sysadmin