Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I need the equivalent of `prstat -Z -n 1 1 1` command in Linux. My script is something like this: $prstat_out=`prstat -Z -n 1 1 1`; lines = split ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    2

    Solaris to Linux porting (prstat -Z -n 1 1 1 ----command help)


    Hi,

    I need the equivalent of `prstat -Z -n 1 1 1` command in Linux.

    My script is something like this:

    $prstat_out=`prstat -Z -n 1 1 1`;
    lines = split (/\n/, $prstat_out);
    foreach $line (lines){
    if ($line =~ /(\s+)(\d+)(\s+)(\d+)(\s+)(\d+.*)(\s+)(\d+.*)(\s+)( \d+)%(\s+)(.*).*).*)(\s+)(.*)% global/){
    $proc_usage=$16;

    print "The CPU usage is $proc_usage ";


    This will print the CPU usage in percentage in Solaris.

    Can anybody help me in knowing the equivalent in Linux.

    Thanks,
    Henry

  2. #2
    Just Joined!
    Join Date
    Dec 2010
    Posts
    1

    Solaris to Linux porting (prstat -Z -n 1 1 1 ----command help)

    Try 'top -n 1' - and rearrange your parsing logic...

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    2
    Thanks

    The issue is solved...

  4. #4
    Just Joined!
    Join Date
    May 2006
    Posts
    36
    Although the topic is solved, this might add some info for others that are looking for something similar:
    DTrace Troubleshooting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •