Whamcloud - gitweb
b=22327 "lfs df" does not print stats for all mountpoints
[fs/lustre-release.git] / lustre / utils / llanalyze
index 40166a5..0ca2d18 100644 (file)
@@ -7,7 +7,6 @@ GetOptions("pid=i" => \$pid,
            "trace!" => \$trace, 
            "silent!" => \$silent, 
            "rpctrace!" => \$rpctrace, 
-           "lmvtrace!" => \$lmvtrace, 
            "nodlm!" => \$nodlm,
            "dlm_ns=s" => \$dlm_ns,
            "noclass!" => \$noclass,
@@ -15,6 +14,8 @@ GetOptions("pid=i" => \$pid,
            "extract_start=s" => \$extract_start,
            "extract_end=s" => \$extract_end);
 
+
+
 $subsys->{UNDEFINED} = 1 << 0;
 $subsys->{MDC} = 1 << 1;
 $subsys->{MDS} = 1 << 2;
@@ -37,11 +38,7 @@ $subsys->{LOV} = 1 << 18;
 $subsys->{GMNAL} = 1 << 19;
 $subsys->{PTLROUTER} = 1 << 20;
 $subsys->{COBD} = 1 << 21;
-$subsys->{IBNAL} = 1 << 22;
-$subsys->{SM} = 1 << 23;
-$subsys->{ASOBD} = 1 << 24;
-$subsys->{LMV} = 1 << 25;
-$subsys->{CMOBD} = 1 << 26;
+$subsys->{OPENIBNAL} = 1 << 22;
 
 
 $masks->{TRACE} = 1 << 0; # /* ENTRY/EXIT markers */
@@ -64,13 +61,13 @@ $masks->{DLMTRACE} = 1 << 16; #
 $masks->{ERROR} = 1 << 17; # /* CERROR} = ...) == CDEBUG} = D_ERROR, ...) */
 $masks->{EMERG} = 1 << 18; # /* CEMERG} = ...) == CDEBUG} = D_EMERG, ...) */
 $masks->{HA} = 1 << 19; # /* recovery and failover */
-$masks->{RPCTRACE} = 1 << 20; # /* recovery and failover */
+$masks->{RPCTRACE} = 1 << 19; # /* recovery and failover */
 
 sub extractpid
 {
     $line = shift;
 #    print "$_\n";
-    if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):.*$/) {
+    if ($line =~ /(\d+)\:(\d+)\:(\d+)\:(\d+\.\d+)\:(\d+)\:(\d+)\:.*/) {
        return $6;
     }
 }
@@ -79,27 +76,10 @@ sub extracthostpid
 {
     $line = shift;
 #    print "$_\n";
-    if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
+    if ($line =~ /(\d+)\:(\d+)\:(\d+)\:(\d+\.\d+)\:(\d+)\:(\d+)\:(\d+)\:.*/) {
        return $7;
     }
 }
-sub extractsubsys
-{
-    $line = shift;
-#    print "$_\n";
-    if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
-       return hex($1);
-    }
-}
-
-sub extractmask
-{
-    $line = shift;
-#    print "$_\n";
-    if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
-       return hex($2);
-    }
-}
 
 sub entering_rpc
 {
@@ -286,28 +266,29 @@ if ($ARGV[1]) {
    $width = $ARGV[1];
 }
 
-print "nodlm $nodlm, nonet $nonet, trace $trace lmvtrace $lmvtrace\n";
+print "nodlm $nodlm, nonet $nonet, trace $trace\n";
 print "pid: $pid, dlm_ns: $dlm_ns\n";
 print "extract_start: $extract_start\n";
 print "extract_end:   $extract_end\n";
 while (<LOG>) {
-    if ($extract_start && $extract_start != LLANAYZE_FOUND) {
+    if ($extract_start && $extract_start ne "LLANAYZE_FOUND") {
         next if (index($_, $extract_start, 0) == -1);
-        $extract_start = LLANAYZE_FOUND;
+        $extract_start = "LLANAYZE_FOUND";
     }
 
     if ($extract_end) {
-        next if ($extract_end == LLANAYZE_FOUND);
+       next if ($extract_end eq "LLANAYZE_FOUND");
         if (index($_, $extract_end, 0) != -1) {
-             $extract_end = LLANAYZE_FOUND;
+             $extract_end = "LLANAYZE_FOUND";
         }
     }
 
     $linepid = extractpid($_);
-
     $linehpid = extracthostpid($_);
-    $linesubsys = extractsubsys($_);
-    $linemask = extractmask($_);
+    $linemask = getmask($_);
+    $linesubsys = getsubsys($_);
+
+#    printf "---> mask %x subsys %x\n", $linemask, $linesubsys;
 
     if (leaving($_)) {
         chop $prefix->{$linepid};
@@ -326,8 +307,6 @@ while (<LOG>) {
         next if ($trace && $linemask != $masks->{TRACE});
         next if ($nodlm && 
                  (  $linesubsys == $subsys->{LDLM}));
-        next if ($lmvtrace && 
-                 (  $linesubsys != $subsys->{LMV}));
         next if ($dlm_ns &&
                  (  $linesubsys != $subsys->{LDLM}));
         next if (($found_dlm_ns = index( $_, $dlm_ns, 0)) == -1);
@@ -339,7 +318,7 @@ while (<LOG>) {
                     $linesubsys == $subsys->{PORTALS} ||
                     $linesubsys == $subsys->{SOCKNAL} ||
                     $linesubsys == $subsys->{QSWNAL} ||
-                    $linesubsys == $subsys->{IBNAL} ||
+                    $linesubsys == $subsys->{OPENIBNAL} ||
                     $linesubsys == $subsys->{GMNAL}));
        if(!$entering_rpc) {entering_rpc($_);}
        if(!$leaving_rpc) {leaving_rpc($_);}
@@ -365,3 +344,109 @@ while (<LOG>) {
 unmatched_intents();
 hanging_locks();
 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);
+
+__END__
+
+=head1 NAME
+
+llanalyze - Analyze distributed Lusture debug logs.
+
+=head1 SYNOPSIS
+
+=over 4
+
+=item B<llanalyze> [OPTIONS]... LOG_FILE
+
+=back
+
+=head1 DESCRIPTION
+
+=over
+
+=item
+
+B<llanalyze> formats the distributed lustre debug logs. It is also used for selective display of logs based on component, identifiers and string match.
+
+=over
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-pid> PID_NUMBER
+
+Display all debug messages with the process identifier specified.
+
+
+=item B<-trace>
+
+
+Display all debug messages which are entry, exit markers.
+
+
+=item B<-silent>
+
+
+Display only those debug messages which are to indicate hanging locks and unmatched intents.
+
+
+=item B<-rpctrace>
+
+
+Displays only those debug messages which are related with subsystem RPC.
+
+
+=item B<-nodlm>
+
+
+Displays all the debug messages except the ones related with subsystem LDLM.
+
+
+=item B<-dlm_ns> STRING
+
+
+Displays all the LDLM related debug messages with the string match.
+
+
+=item B<-noclass>
+
+
+Displays all the debug messages except the ones which are related with subsystem class.
+
+
+=item B<-nonet>
+
+Displays all the debug messages except those related to sub-system NET.
+
+
+=item B<-extract_start> STRING
+
+Displays all the debug messages from the start of the log file till the occurence of the specified string in the debug messages.
+
+
+=item B<-extract_end> STRING
+
+Displays all the debug messages from the occurence of the specified string till the end of the log file.
+
+
+=back
+
+=head1 REPORTING BUGS
+
+Please report all bugs to Sun Microsystems, Inc. http://bugzilla.lustre.org/
+
+
+=head1 AVAILABILITY
+
+llanalyze is part of the Lustre(7) filesystem package and is available from http://www.sun.com/software/products/lustre/index.xml
+
+=head1 SEE ALSO
+
+=over 4
+
+=item   B<lctl>(8), B<lfs>(1)
+
+=back
+
+=cut
+