Load information in Solaris (Perl Script.)

A

Alice Stamp

Hi

(Tried to post this last night, but Google seems to have swallowed it.)


I have a script which makes use of the cpu data which I can read from
/proc/stat on Linux. I need to know the number of jiffies the cpu has
spent in user, system, and idle modes since boot up - easy enough to
do on Linux :

====
open (DATA, "/proc/stat");
my $rd;
do{
$rd = <DATA>;
} until ($rd =~ /^cpu/);
close PSF;
my @cline = split (/ /, $rd);
my $u = $cline[2];
my $s = $cline[4];
my $i = $cline[5];
====

I now need to write a similar perl script which does the same on
solaris (i.e. end up with the amount of time the cpu has spent in each
mode in three variables.

I know that /proc doesn't have these kernel 'summary' files that Linux
has, and the output from iostat doesn't really help. Is there another
utility I can call to pull out this data, or can someone recommend a
module which supplies the data I need (amount of time SINCE BOOT)
spent in each mode.

Thank you for any help that you can offer.

BR
AS
 
P

Peter Michael

Alice,

I have a script which makes use of the cpu data which I can read from
/proc/stat on Linux. I need to know the number of jiffies the cpu has
spent in user, system, and idle modes since boot up - easy enough to
do on Linux :
[snip]

I now need to write a similar perl script which does the same on
solaris (i.e. end up with the amount of time the cpu has spent in each
mode in three variables.

Have a look at the Solaris::Kstat module.

HTH,

Peter
 
M

Michele Dondi

open (DATA, "/proc/stat");

As a side note to what has already been said, that is an unfortunate
choice as the name for your fh. Why not using a lexical fh anyway?


Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,614
Members
45,293
Latest member
Hue Tran

Latest Threads

Top