6 GetOptions("pid=i" => \$pid,
9 "rpctrace!" => \$rpctrace,
11 "noclass!" => \$noclass,
14 print "pid: $pid, nodlm $nodlm nonet $nonet trace $trace\n";
17 $subsys->{UNDEFINED} = 0;
26 $subsys->{EXT2OBD} = 9;
27 $subsys->{PORTALS} = 10;
28 $subsys->{SOCKNAL} = 11;
29 $subsys->{QSWNAL} = 12;
30 $subsys->{PINGER} = 13;
31 $subsys->{FILTER} = 14;
32 $subsys->{TRACE} = 15; # obdtrace, not to be confused with D_TRACE */
36 $subsys->{GMNAL} = 19;
37 $subsys->{PTLROUTER} = 20;
40 $masks->{TRACE} = 1 << 0; # /* ENTRY/EXIT markers */
41 $masks->{INODE} = 1 << 1; #
42 $masks->{SUPER} = 1 << 2; #
43 $masks->{EXT2} = 1 << 3; # /* anything from ext2_debug */
44 $masks->{MALLOC} = 1 << 4; # /* print malloc, free information */
45 $masks->{CACHE} = 1 << 5; # /* cache-related items */
46 $masks->{INFO} = 1 << 6; # /* general information */
47 $masks->{IOCTL} = 1 << 7; # /* ioctl related information */
48 $masks->{BLOCKS} = 1 << 8; # /* ext2 block allocation */
49 $masks->{NET} = 1 << 9; # /* network communications */
50 $masks->{WARNING} = 1 << 10; #
51 $masks->{BUFFS} = 1 << 11; #
52 $masks->{OTHER} = 1 << 12; #
53 $masks->{DENTRY} = 1 << 13; #
54 $masks->{PORTALS} = 1 << 14; # /* ENTRY/EXIT markers */
55 $masks->{PAGE} = 1 << 15; # /* bulk page handling */
56 $masks->{DLMTRACE} = 1 << 16; #
57 $masks->{ERROR} = 1 << 17; # /* CERROR} = ...) == CDEBUG} = D_ERROR, ...) */
58 $masks->{EMERG} = 1 << 18; # /* CEMERG} = ...) == CDEBUG} = D_EMERG, ...) */
59 $masks->{HA} = 1 << 19; # /* recovery and failover */
60 $masks->{RPCTRACE} = 1 << 19; # /* recovery and failover */
73 $entering = /Process entered/;
79 $entering = /Process leaving/;
84 my ($subsys, $mask) = split ":";
90 my ($subsys, $mask) = split ":";
97 if ($linemask == $masks->{TRACE}) {
98 print color("yellow on_black");
100 if ($linemask == $masks->{DLMTRACE}) {
101 print color("magenta on_black");
103 if ($linemask == $masks->{DLM}) {
104 print color("magenta on_black");
106 if ($linemask == $masks->{DENTRY}) {
107 print color("red on_black");
116 $rc = /completion callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
118 $completion_callbacks{$1}->{$2} = $3;
119 # print color("white");
120 # print "---CP CB START: $1 $2 $3\n";
121 # print color("reset");
123 $rc = /callback handler finished.* ns: (.*) lock: (.*) lrc: (.*) mode/;
125 # print color("white");
126 # print "---CP CB END: $1 $2 $3 deleting $completion_callbacks{$1}->{$2}\n";
127 # print color("reset");
128 delete $completion_callbacks{$1}->{$2};
132 $rc = /client blocking AST callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
133 $blocking_callbacks{$1}->{$2} = $3;
134 # print color("white");
135 # print "---BL CB START: $1 $2\n";
136 # print color("reset");
138 $rc = /client blocking callback handler END ns: (.*) lock: (.*) lrc: (.*) mode/;
140 # print color("white");
141 # print "---BL CB END: $1 $2 $3 deleting $blocking_callbacks{$1}->{$2}\n";
142 # print color("reset");
143 delete $blocking_callbacks{$1}->{$2};
146 $rc = /ldlm_lock_addref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
147 # print color("white");
148 # print "------>addref ns: $1 lock: $2 lrc: $3\n" if ($rc);
149 # print color("reset");
150 $locks{$1}->{$2} = {$3} if ($rc);
151 $rc = /ldlm_lock_decref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
152 # print color("white");
153 # print "------>decref ns: $1 lock: $2 lrc: $3\n" if ($rc);
154 # print color("reset");
155 $locks{$1}->{$2} = {$3} if ($rc);
163 foreach (keys %completion_callbacks) {
166 foreach (keys %{$completion_callbacks{$ns}}) {
168 print "Unfinished completions in ns $ns: \n";
171 print " lock: $_ lrc: $completion_callbacks{$ns}->{$_}\n";
174 foreach (keys %blocking_callbacks) {
177 foreach (keys %{$blocking_callbacks{$ns}}) {
179 print "Unfinished blocking in ns $ns: \n";
182 printf(" lock: $_ lrc: %s\n", $blocking_callbacks{$ns}->{$_});
193 $rc = /D_IT UP dentry (.*) fsdata/;
194 delete $it{$1} if ($rc);
195 $rc = /D_IT DOWN dentry (.*) fsdata/;
196 $it{$1} = "yes" if ($rc);
199 sub unmatched_intents {
203 print "Unmatched intents: \n";
211 $linepid = extractpid($_);
212 $linemask = getmask($_);
213 $linesubsys = getsubsys($_);
215 # printf "---> mask %x subsys %x\n", $linemask, $linesubsys;
218 chop $prefix->{$linepid};
219 chop $prefix->{$linepid};
222 if ($linemask == $masks->{DENTRY}) {
225 if ($linemask == $masks->{DLMTRACE}) {
229 if ( !$pid || $linepid == $pid) {
230 next if ($rpctrace && $linemask != $masks->{RPCTRACE});
231 next if ($trace && $linemask != $masks->{TRACE});
235 ( $linesubsys == $subsys->{LDLM}));
237 ( $linesubsys == $subsys->{CLASS}));
240 ( $linesubsys == $subsys->{RPC} ||
241 $linesubsys == $subsys->{NET} ||
242 $linesubsys == $subsys->{PORTALS} ||
243 $linesubsys == $subsys->{SOCKNAL} ||
244 $linesubsys == $subsys->{QSWNAL} ||
245 $linesubsys == $subsys->{GMNAL}));
248 # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_);
251 printf("%s%s", $prefix->{$linepid}, $_);
252 print color("reset");
254 # last if $count++ > 100;
257 $prefix->{$linepid} .= ' ';
264 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);