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 */
66 if ($line =~ m/\(\) ([0-9]*)\+[0-9]*\):/) {
69 if ($line =~ m/\(\) ([0-9]*) | [0-9]*\+[0-9]*\):/) {
77 $entering = /Process entered/;
83 $entering = /Process leaving/;
88 my ($subsys, $mask) = split ":";
94 my ($subsys, $mask) = split ":";
100 my $linemask = shift;
101 if ($linemask == $masks->{TRACE}) {
102 print color("yellow on_black");
104 if ($linemask == $masks->{DLMTRACE}) {
105 print color("magenta on_black");
107 if ($linemask == $masks->{DLM}) {
108 print color("magenta on_black");
110 if ($linemask == $masks->{DENTRY}) {
111 print color("red on_black");
120 $rc = /completion callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
122 $completion_callbacks{$1}->{$2} = $3;
123 # print color("white");
124 # print "---CP CB START: $1 $2 $3\n";
125 # print color("reset");
127 $rc = /callback handler finished.* ns: (.*) lock: (.*) lrc: (.*) mode/;
129 # print color("white");
130 # print "---CP CB END: $1 $2 $3 deleting $completion_callbacks{$1}->{$2}\n";
131 # print color("reset");
132 delete $completion_callbacks{$1}->{$2};
136 $rc = /client blocking AST callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
137 $blocking_callbacks{$1}->{$2} = $3;
138 # print color("white");
139 # print "---BL CB START: $1 $2\n";
140 # print color("reset");
142 $rc = /client blocking callback handler END ns: (.*) lock: (.*) lrc: (.*) mode/;
144 # print color("white");
145 # print "---BL CB END: $1 $2 $3 deleting $blocking_callbacks{$1}->{$2}\n";
146 # print color("reset");
147 delete $blocking_callbacks{$1}->{$2};
150 $rc = /ldlm_lock_addref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
151 # print color("white");
152 # print "------>addref ns: $1 lock: $2 lrc: $3\n" if ($rc);
153 # print color("reset");
154 $locks{$1}->{$2} = {$3} if ($rc);
155 $rc = /ldlm_lock_decref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
156 # print color("white");
157 # print "------>decref ns: $1 lock: $2 lrc: $3\n" if ($rc);
158 # print color("reset");
159 $locks{$1}->{$2} = {$3} if ($rc);
167 foreach (keys %completion_callbacks) {
170 foreach (keys %{$completion_callbacks{$ns}}) {
172 print "Unfinished completions in ns $ns: \n";
175 print " lock: $_ lrc: $completion_callbacks{$ns}->{$_}\n";
178 foreach (keys %blocking_callbacks) {
181 foreach (keys %{$blocking_callbacks{$ns}}) {
183 print "Unfinished blocking in ns $ns: \n";
186 printf(" lock: $_ lrc: %s\n", $blocking_callbacks{$ns}->{$_});
197 $rc = /D_IT UP dentry (.*) fsdata/;
198 delete $it{$1} if ($rc);
199 $rc = /D_IT DOWN dentry (.*) fsdata/;
200 $it{$1} = "yes" if ($rc);
203 sub unmatched_intents {
207 print "Unmatched intents: \n";
215 $linepid = extractpid($_);
216 $linemask = getmask($_);
217 $linesubsys = getsubsys($_);
219 # printf "---> mask %x subsys %x\n", $linemask, $linesubsys;
222 chop $prefix->{$linepid};
223 chop $prefix->{$linepid};
226 if ($linemask == $masks->{DENTRY}) {
229 if ($linemask == $masks->{DLMTRACE}) {
233 if ( !$pid || $linepid == $pid) {
234 next if ($rpctrace && $linemask != $masks->{RPCTRACE});
235 next if ($trace && $linemask != $masks->{TRACE});
239 ( $linesubsys == $subsys->{LDLM}));
241 ( $linesubsys == $subsys->{CLASS}));
244 ( $linesubsys == $subsys->{RPC} ||
245 $linesubsys == $subsys->{NET} ||
246 $linesubsys == $subsys->{PORTALS} ||
247 $linesubsys == $subsys->{SOCKNAL} ||
248 $linesubsys == $subsys->{QSWNAL} ||
249 $linesubsys == $subsys->{GMNAL}));
252 # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_);
255 printf("%s%s", $prefix->{$linepid}, $_);
256 print color("reset");
258 # last if $count++ > 100;
261 $prefix->{$linepid} .= ' ';
268 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);