Operating System - HP-UX
1834220 Members
2844 Online
110066 Solutions
New Discussion

Extended Memory/CPU Excerise Script ?

 
SOLVED
Go to solution
TYP3R
Frequent Advisor

Extended Memory/CPU Excerise Script ?

Hi Guru

Is there a way/script that can excerise memory/CPU continuously ? I know i can excerise using stm but that only gives a good 10min excerise.. I need excerise these memory and CPU continuosly for over night incase it fails over, Then we install it on a production server.

Any kind of help would be grateful

Will
5 REPLIES 5
VK2COT
Honored Contributor
Solution

Re: Extended Memory/CPU Excerise Script ?

Hello,

You could do it through many ways, including
primitive but efficient scripts.

For example:

a) A small Shell script:

#!/bin/sh
while true
do
# Test only CPU 1
#
dd if=/dev/rdsk/c0t0d0 of=veryBigFile bs=2048k
mpsched -c 1 gzip veryBigFile
rm -f veryBigFile.gz
done
exit 0

This will run endlessly until script killed.

b) Perl one-liner:

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

By default this will run for 60-seconds. Pass
any number of seconds as an argument.

c) Several years ago, another poster
(Ermin Borovac), submitted a small C
program:

#include
int main()
{
int ret;
size_t datsiz = 2147483648;
size_t stsiz = 0;

ret = datalock(datsiz, stsiz);
if (ret == -1) {
perror("datalock");
exit(1);
}

for (;;) {
}

return 0;
}

Compile it with 'cc +DD64'. It should create
a process with 2G data space (of course
adjust this number based on how much memory
you have on your system).

I did not try this C personally.

d) You could even use Linux Test Project
Suite (LTP) and extract various scripts that
suit you for HP-UX:

http://ltp.sourceforge.net/

The LTP has over 3,000 test for Linux :)

e) If you want a vendor-based tool,
and you run HP-UX 11.23 or newer (11.31),
then HP offers it as long as you sign an
ETD Test Tool Non Disclosure Agreement.
Please contact your representative.

HP-UX Meatgrinder is a port of ETD's Linux Meatgrinder test to the HP-UX operating system.

It is available for Itanium and PA-RISC.
Here are some of the test threads:

Ancillary
Audio
Cache
CPU
File System
Flash
Floppy
Interupt
Memory
MultiPCU
Network
PCI Master
Raw Disk
Tape
and more.

I am sure I could come with more ideas, but
I just woke up (Sunday) and need some
coffee to clear my mind :)

Best wishes,

VK2COT
VK2COT - Dusan Baljevic
Michael Steele_2
Honored Contributor

Re: Extended Memory/CPU Excerise Script ?

Here's some pseudo script code which relys on you translating your stm procedure into a cstm procedure and then into a script.

#!/usr/bin/ksh
while
do

echo "selclass memory;info;wait;excercise" | cstm

done

Here's a link to cstm commands.

http://docs.hp.com/en/diag/stm/sth_cstm.htm#OnCommandsFull
Support Fatherhood - Stop Family Law
VK2COT
Honored Contributor

Re: Extended Memory/CPU Excerise Script ?

Hello,

Now I feel better after good breakfast and coffee.

Several more ideas:

a) Run continumously:

md5sum < /dev/urandom

/dev/urandom produces an infinite stream of
random data - just pipe that throgh MD5 for
some nice numerical CPU load. Not disk- or network-bound either.

b) To utilize a lot of memory as well as CPU,
you might look for something
like a prime-factoring program.

#!/usr/bin/perl
#
# There are several ways to calculate primes. Probably, the most efficient
# one is recursively dividing a number with all primes lower than the number
# itself. Since no primes are divisible by numbers other than themselves and 1,
# it would be possible to divide a number with all numbers below it. All numbers
# are essentially built up of primes, and therefore we can safely skip dividing
# by numbers which are not primes themselves, speeding up the process significantly.
#
# The array where the primes will be stored
my @primes = (2);
# The maximum number of iterations
my $max = 1000000;
# The starting iteration
my $i = 2;
# Whether the current loop is to be broken
my $b = 1;
# Start the loop
while ($i < $max) {
# Check for each prime which has already been calculated
foreach $n (@primes) {
# If that prime is not divisible by the the current number..
if (!($i % $n)) {
# ..break the loop
$b = 1;
next;
}
}
# If the loop was supposed to be broken,
if ($b) {
reset $b;
$b = 0;
} else {
# add the number to the prime array
push @primes, $i;
print "This is prime number $i\n";
}
# Increment $i
$i++;
}
exit(0);

or even better version that uses Sieve of Eratosthenes:

#!/usr/bin/perl

print "\n=======================\n";
print "PRIME NUMBERS GENERATOR\n";
print "=======================\n";
# Get the range
# Minimum value of primes
my $min = 1;
# Maximum value of primes;
my $max = 10000000;
# Create a max-sized array
my @primes = (1...$max);
# Initially assume all numbers are prime
for($i = 0; $i < $max; $i++) {
$primes[$i] = 1;
}
# The sieve
for ($i=2; $i*$i <= $max;$i+=1) {
if ($primes[$i]) {
for ($j=$i; $j*$i < $max; $j+=1) {
$primes[$i * $j] = 0;
}
}
}
# Show the results
my @p = ();
for ($i=$min; $i<=$max; $i++) {
if ($primes[$i]) {
push @p, $i;
print qq(Found prime $i\n);
}
}
$size = @p;
# print qq(Found $size primes:\n@p\n);

The Perl scripts are not mine. I gathered
them from the Internet sources.

Cheers,

VK2COT
VK2COT - Dusan Baljevic

Re: Extended Memory/CPU Excerise Script ?

Will,

No need to use other tools - you can easily get the exerciser utility to run for that length of time in stm if you use the right options. This for example will fully exercise CPU and memory for 12 hours (720 minutes):

echo "scl qualifier cpu;scl qualifier memory;eop time 720 maxcoverage;exc;wait;eal;"| cstm

HTH

Duncan

I am an HPE Employee
Accept or Kudo
TYP3R
Frequent Advisor

Re: Extended Memory/CPU Excerise Script ?

Dusan Baljevic - Thanks for all the perl script. I will try them all out and see which one would suit me better

Thanks Michael & Duncan Edmonstone, I would try your pseudo script code aswell