more useful ps output from kvm processes
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 28 Jan 2015 18:56:21 +0000 (19:56 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 28 Jan 2015 18:56:21 +0000 (19:56 +0100)
gnt-i

diff --git a/gnt-i b/gnt-i
index 79d72a5..115b846 100755 (executable)
--- a/gnt-i
+++ b/gnt-i
@@ -18,7 +18,16 @@ if ( @ARGV ) {
 }
 
 # if prefixed with _ it will be hiddden from output, _args must be last!
-my @ps_cols = qw( user pid pcpu pmem vsz cputime etimes _args);
+my @ps_cols = qw( user pid
+       pcpu pmem
+       vsz
+       rss
+       nlwp
+       cputime etimes 
+       maj_flt min_flt
+       psr
+
+       _args);
 
 sub ps_cols_all { map { my $t = $_; $t =~ s/^_//; $t } @ps_cols };
 sub ps_cols_visible { grep { ! /^_/ } @ps_cols };
@@ -53,6 +62,7 @@ while(<$ps>) {
 
        my %h;
        @h{@ps_cols} = split(/\s+/, $_, $#ps_cols + 1);
+       $h{cputime} = DD_hh_mm_ss( $h{cputime} );
 
 #XXX 'h = ', \%h;
        if ( $h{user} =~ m/gnt/ && $h{_args} =~ m/qemu.*-name\s+(\S+)/ ) {
@@ -60,15 +70,13 @@ while(<$ps>) {
                my $name = $1;
                $stat->{$name}->{$_} = $h{$_} foreach ps_cols_all;
 
-               $stat->{$name}->{cputime_} = $stat->{$name}->{cputime} = DD_hh_mm_ss( $stat->{$name}->{cputime} );
-
                while ( $h{_args} =~ m/mac=([0-9a-fA-F:]+)/g ) {
                        $mac_to_name->{$1} = $name;
                }
 
        } else {
 #              warn "## SKIP [$_]\n";
-               $stat->{ '__' . $hostname }->{$_} += $h{$_} foreach qw( pcpu pmem vsz );
+               $stat->{ '__' . $hostname }->{$_} += $h{$_} foreach qw( pcpu pmem vsz rss cputime etimes maj_flt min_flt );
                
        }