6 GetOptions("pid=i" => \$pid,
9 "rpctrace!" => \$rpctrace,
11 "noclass!" => \$noclass,
16 $subsys->{UNDEFINED} = 0;
25 $subsys->{EXT2OBD} = 9;
26 $subsys->{PORTALS} = 10;
27 $subsys->{SOCKNAL} = 11;
28 $subsys->{QSWNAL} = 12;
29 $subsys->{PINGER} = 13;
30 $subsys->{FILTER} = 14;
31 $subsys->{TRACE} = 15; # obdtrace, not to be confused with D_TRACE */
35 $subsys->{GMNAL} = 19;
36 $subsys->{PTLROUTER} = 20;
38 $subsys->{IBNAL} = 22;
41 $masks->{TRACE} = 1 << 0; # /* ENTRY/EXIT markers */
42 $masks->{INODE} = 1 << 1; #
43 $masks->{SUPER} = 1 << 2; #
44 $masks->{EXT2} = 1 << 3; # /* anything from ext2_debug */
45 $masks->{MALLOC} = 1 << 4; # /* print malloc, free information */
46 $masks->{CACHE} = 1 << 5; # /* cache-related items */
47 $masks->{INFO} = 1 << 6; # /* general information */
48 $masks->{IOCTL} = 1 << 7; # /* ioctl related information */
49 $masks->{BLOCKS} = 1 << 8; # /* ext2 block allocation */
50 $masks->{NET} = 1 << 9; # /* network communications */
51 $masks->{WARNING} = 1 << 10; #
52 $masks->{BUFFS} = 1 << 11; #
53 $masks->{OTHER} = 1 << 12; #
54 $masks->{DENTRY} = 1 << 13; #
55 $masks->{PORTALS} = 1 << 14; # /* ENTRY/EXIT markers */
56 $masks->{PAGE} = 1 << 15; # /* bulk page handling */
57 $masks->{DLMTRACE} = 1 << 16; #
58 $masks->{ERROR} = 1 << 17; # /* CERROR} = ...) == CDEBUG} = D_ERROR, ...) */
59 $masks->{EMERG} = 1 << 18; # /* CEMERG} = ...) == CDEBUG} = D_EMERG, ...) */
60 $masks->{HA} = 1 << 19; # /* recovery and failover */
61 $masks->{RPCTRACE} = 1 << 19; # /* recovery and failover */
67 if ($line =~ m/\d+:\d+:\d+:\d+\.\d+:\d+:\d+:*$/) {
76 if ($line =~ m/\d+:\d+:\d+:\d+\.\d+:\d+:\d+:\d+:*$/) {
84 $entering_rpc = /Handling RPC/;
87 $pid = extractpid($_);
95 $leaving_rpc = /Handled RPC/;
105 $entering = /Process entered/;
111 $entering = /Process leaving/;
116 my ($subsys, $mask) = split ":";
122 my ($subsys, $mask) = split ":";
128 my $linemask = shift;
130 if ($linemask == $masks->{TRACE}) {
132 print color("yellow on_black");
134 print color("green on_black");
137 if ($linemask == $masks->{DLMTRACE}) {
138 print color("magenta on_black");
140 if ($linemask == $masks->{DLM}) {
141 print color("magenta on_black");
143 if ($linemask == $masks->{DENTRY}) {
144 print color("red on_black");
153 $rc = /completion callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
155 $completion_callbacks{$1}->{$2} = $3;
156 # print color("white");
157 # print "---CP CB START: $1 $2 $3\n";
158 # print color("reset");
160 $rc = /callback handler finished.* ns: (.*) lock: (.*) lrc: (.*) mode/;
162 # print color("white");
163 # print "---CP CB END: $1 $2 $3 deleting $completion_callbacks{$1}->{$2}\n";
164 # print color("reset");
165 delete $completion_callbacks{$1}->{$2};
169 $rc = /client blocking AST callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
170 $blocking_callbacks{$1}->{$2} = $3;
171 # print color("white");
172 # print "---BL CB START: $1 $2\n";
173 # print color("reset");
175 $rc = /client blocking callback handler END ns: (.*) lock: (.*) lrc: (.*) mode/;
177 # print color("white");
178 # print "---BL CB END: $1 $2 $3 deleting $blocking_callbacks{$1}->{$2}\n";
179 # print color("reset");
180 delete $blocking_callbacks{$1}->{$2};
183 $rc = /ldlm_lock_addref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
184 # print color("white");
185 # print "------>addref ns: $1 lock: $2 lrc: $3\n" if ($rc);
186 # print color("reset");
187 $locks{$1}->{$2} = {$3} if ($rc);
188 $rc = /ldlm_lock_decref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
189 # print color("white");
190 # print "------>decref ns: $1 lock: $2 lrc: $3\n" if ($rc);
191 # print color("reset");
192 $locks{$1}->{$2} = {$3} if ($rc);
200 foreach (keys %completion_callbacks) {
203 foreach (keys %{$completion_callbacks{$ns}}) {
205 print "Unfinished completions in ns $ns: \n";
208 print " lock: $_ lrc: $completion_callbacks{$ns}->{$_}\n";
211 foreach (keys %blocking_callbacks) {
214 foreach (keys %{$blocking_callbacks{$ns}}) {
216 print "Unfinished blocking in ns $ns: \n";
219 printf(" lock: $_ lrc: %s\n", $blocking_callbacks{$ns}->{$_});
230 $rc = /D_IT UP dentry (.*) fsdata/;
231 delete $it{$1} if ($rc);
232 $rc = /D_IT DOWN dentry (.*) fsdata/;
233 $it{$1} = "yes" if ($rc);
236 sub unmatched_intents {
240 print "Unmatched intents: \n";
249 print "Usage : llanalyze LOGFILE\n";
254 if(!open(LOG, "<$ARGV[0]")){
255 print "Cannot open $ARGV[0]\n";
266 print "pid: $pid, nodlm $nodlm nonet $nonet trace $trace\n";
268 $linepid = extractpid($_);
269 $linehpid = extracthostpid($_);
270 $linemask = getmask($_);
271 $linesubsys = getsubsys($_);
273 # printf "---> mask %x subsys %x\n", $linemask, $linesubsys;
276 chop $prefix->{$linepid};
277 chop $prefix->{$linepid};
280 if ($linemask == $masks->{DENTRY}) {
283 if ($linemask == $masks->{DLMTRACE}) {
287 if ( !$pid || $linepid == $pid || $linehpid == $pid) {
288 next if (!$entering_rpc && $rpctrace && $linemask != $masks->{RPCTRACE});
289 next if ($trace && $linemask != $masks->{TRACE});
293 ( $linesubsys == $subsys->{LDLM}));
295 ( $linesubsys == $subsys->{CLASS}));
298 ( $linesubsys == $subsys->{RPC} ||
299 $linesubsys == $subsys->{NET} ||
300 $linesubsys == $subsys->{PORTALS} ||
301 $linesubsys == $subsys->{SOCKNAL} ||
302 $linesubsys == $subsys->{QSWNAL} ||
303 $linesubsys == $subsys->{IBNAL} ||
304 $linesubsys == $subsys->{GMNAL}));
305 if(!$entering_rpc) {entering_rpc($_);}
306 if(!$leaving_rpc) {leaving_rpc($_);}
308 # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_);
310 setcolor($linemask, $_);
311 my $string = $prefix->{$linepid}.$_;
313 $string = substr($string, 0, $width)."\n";
315 printf("%s", $string);
316 print color("reset");
318 # last if $count++ > 100;
321 $prefix->{$linepid} .= ' ';
328 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);