Load information in Solaris (Perl Script.)

Discussion in 'Perl Misc' started by Alice Stamp, Nov 5, 2004.

  1. Alice Stamp

    Alice Stamp Guest

    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
    Alice Stamp, Nov 5, 2004
    #1
    1. Advertising

  2. Alice Stamp <> wrote:


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


    > close PSF;



    One of those things is not like the other, one of those things
    just doesn't belong...



    > Is there another
    > utility I can call to pull out this data,


    comp.unix.solaris is over that-a-way ---->

    :)


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Nov 5, 2004
    #2
    1. Advertising

  3. Alice,

    "Alice Stamp" <> schrieb im Newsbeitrag
    news:...

    > 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
    Peter Michael, Nov 5, 2004
    #3
  4. On 4 Nov 2004 17:09:50 -0800, (Alice Stamp) wrote:

    >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
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Nov 5, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,517
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,792
  3. pj
    Replies:
    3
    Views:
    284
  4. Petterson Mikael

    Execute another perl script from my perl script

    Petterson Mikael, Jan 5, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    137
    Paul Lalli
    Jan 5, 2005
  5. inetquestion
    Replies:
    4
    Views:
    325
    Josef Moellers
    Aug 9, 2007
Loading...

Share This Page