Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trusted Solaris 8 and the Tale of CPU Utilization 1

Status
Not open for further replies.

mstonbely

Technical User
Mar 28, 2007
3
US
I am perplexed... and I hope that someone knows the answer.
I am trying to get the CPU utilization of a SunFire v880 running Trusted Solaris 8 to +/- 98%.
If I were to do this in Solaris 9 or 10, I could use containers and FSS to make a smaller portion of the CPU available to me, but that doesn't work with Trusted Solaris (at least not that I know of). I would use a terminal with the command yes>/dev/null but that doesn't seem to work with TS8 either.
I have been looking online for some kind of test tool that will run up a CPU for Trusted Solaris, but can't seem to find one. Does anyone have any ideas?

Thanks in advance,
Melissa
 
In a multi-processor system you may need to run multiple processes to keep all of the processors busy. I usually use something like:

[tt]ksh -c 'while : ; do : ; done' &
ksh -c 'while : ; do : ; done' &
...[/tt]

Annihilannic.
 
That is a super idea! Thanks. I was able to get the cpu utilization to 50% and then 100% when I ran more than one instance. Is there a way to get it to ~97% so that another process could actually run alongside it?

Thanks again!
Melissa

 
Even if it's at 100% and you run another process it should still allow it to run alongside it, as the OS will try and balance the available system resources between the running processes.

You could also experiment with 'nice' values for each process to give one more priority than the other. See the nice and renice man pages.

Annihilannic.
 
Code:
#!/usr/bin/perl
# getload.pl
# Fire up 2 cpu-intensive tasks in the background
system("./burncpu &");
system("./burncpu &");

while (1) {
   @uptime = split (/ /, 'uptime');
   foreach $up (@uptime) {
      if ($up =~ m/(\d\d:\d\d:\d\d)/) {
         print "$1\t";
      }
      if ($up =~ m/(\d{1,}\.\d\d)/) {
         Print "$1\t";
      }
   }
   print "\n";
   sleep ($sample_interval);
}
Code:
// burncpu.c

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define MAXARRAY   100
long int         m[MAXARRAY];
double           a[MAXARRAY];

int main(void) {
   int       i;
   void      StuffMatrices();
   StuffMatrices();
   for (i = 0; i < MAXARRAY; i++) {
      a[i] = a[100 -i] * m[i];
      if (i == MAXARRAY - 1) {
        i = 0;
      }
   }
}

void StuffMatrices() {
   int         k;
   for (k = 0; k < MAXARRAY; k++) {
      a[k] = (double) random ();
      m[k] = random ();
   }
}
 
That definitely did the trick kHz! Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top