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
Solaris to Linux porting (prstat -Z -n 1 1 1 ----command help)
Try 'top -n 1' - and rearrange your parsing logic...