X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fllanalyze;h=97c691a038498bc672460b2ed1f784d9d1934711;hp=56e58c88dd752e31e9bd7106d3ecb96abfa43fe9;hb=c5050e412572b00cbe93d8517d2d1f767bebfa92;hpb=1d04a7876e12a33c65fdc89eb00ec344754a5d80 diff --git a/lustre/utils/llanalyze b/lustre/utils/llanalyze index 56e58c8..97c691a 100644 --- a/lustre/utils/llanalyze +++ b/lustre/utils/llanalyze @@ -11,7 +11,6 @@ GetOptions("pid=i" => \$pid, "noclass!" => \$noclass, "nonet!" => \$nonet); -print "pid: $pid, nodlm $nodlm nonet $nonet trace $trace\n"; $subsys->{UNDEFINED} = 0; @@ -35,6 +34,8 @@ $subsys->{LDLM} = 17; $subsys->{LOV} = 18; $subsys->{GMNAL} = 19; $subsys->{PTLROUTER} = 20; +$subsys->{COBD} = 21; +$subsys->{IBNAL} = 22; $masks->{TRACE} = 1 << 0; # /* ENTRY/EXIT markers */ @@ -63,11 +64,8 @@ sub extractpid { $line = shift; # print "$_\n"; - if ($line =~ m/\(\) ([0-9]*)\+[0-9]*\):/) { - return $1; - } - if ($line =~ m/\(\) ([0-9]*) \| [0-9]*\+[0-9]*\):/) { - return $1; + if ($line =~ m/\d+:\d+:\d+:\d+\.\d+:\d+:\d+:*$/) { + return $6; } } @@ -75,11 +73,32 @@ sub extracthostpid { $line = shift; # print "$_\n"; - if ($line =~ m/\(\) [0-9]* \| ([0-9]*)\+[0-9]*\):/) { - return $1; + if ($line =~ m/\d+:\d+:\d+:\d+\.\d+:\d+:\d+:\d+:*$/) { + return $7; } } +sub entering_rpc +{ + $_ = shift; + $entering_rpc = /Handling RPC/; + if($entering_rpc) { + $oldpid=$pid; + $pid = extractpid($_); + $leaving_rpc = 0; + } +} + +sub leaving_rpc +{ + $_ = shift; + $leaving_rpc = /Handled RPC/; + if($leaving_rpc) { + $pid = $oldpid; + $entering_rpc = 0; + } +} + sub entering { $_ = shift; @@ -107,8 +126,13 @@ sub getmask sub setcolor { my $linemask = shift; + my $line = shift; if ($linemask == $masks->{TRACE}) { - print color("yellow on_black"); + if(leaving($line)){ + print color("yellow on_black"); + } else { + print color("green on_black"); + } } if ($linemask == $masks->{DLMTRACE}) { print color("magenta on_black"); @@ -220,7 +244,27 @@ sub unmatched_intents { } } -while () { +sub usage +{ + print "Usage : llanalyze LOGFILE\n"; + exit; +} + +if ($ARGV[0]) { + if(!open(LOG, "<$ARGV[0]")){ + print "Cannot open $ARGV[0]\n"; + exit; + } +} else { + usage(); +} +$width = 0; +if ($ARGV[1]) { + $width = $ARGV[1]; +} + +print "pid: $pid, nodlm $nodlm nonet $nonet trace $trace\n"; +while () { $linepid = extractpid($_); $linehpid = extracthostpid($_); $linemask = getmask($_); @@ -241,7 +285,7 @@ while () { } if ( !$pid || $linepid == $pid || $linehpid == $pid) { - next if ($rpctrace && $linemask != $masks->{RPCTRACE}); + next if (!$entering_rpc && $rpctrace && $linemask != $masks->{RPCTRACE}); next if ($trace && $linemask != $masks->{TRACE}); @@ -256,13 +300,19 @@ while () { $linesubsys == $subsys->{PORTALS} || $linesubsys == $subsys->{SOCKNAL} || $linesubsys == $subsys->{QSWNAL} || + $linesubsys == $subsys->{IBNAL} || $linesubsys == $subsys->{GMNAL})); - + if(!$entering_rpc) {entering_rpc($_);} + if(!$leaving_rpc) {leaving_rpc($_);} # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_); - if (!$silent) { - setcolor($linemask); - printf("%s%s", $prefix->{$linepid}, $_); + if (!$silent) { + setcolor($linemask, $_); + my $string = $prefix->{$linepid}.$_; + if($width){ + $string = substr($string, 0, $width)."\n"; + } + printf("%s", $string); print color("reset"); } # last if $count++ > 100;