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]*\):/) {
78 if ($line =~ m/\(\) [0-9]* \| ([0-9]*)\+[0-9]*\):/) {
86 $entering = /Process entered/;
92 $entering = /Process leaving/;
97 my ($subsys, $mask) = split ":";
103 my ($subsys, $mask) = split ":";
109 my $linemask = shift;
110 if ($linemask == $masks->{TRACE}) {
111 print color("yellow on_black");
113 if ($linemask == $masks->{DLMTRACE}) {
114 print color("magenta on_black");
116 if ($linemask == $masks->{DLM}) {
117 print color("magenta on_black");
119 if ($linemask == $masks->{DENTRY}) {
120 print color("red on_black");
129 $rc = /completion callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
131 $completion_callbacks{$1}->{$2} = $3;
132 # print color("white");
133 # print "---CP CB START: $1 $2 $3\n";
134 # print color("reset");
136 $rc = /callback handler finished.* ns: (.*) lock: (.*) lrc: (.*) mode/;
138 # print color("white");
139 # print "---CP CB END: $1 $2 $3 deleting $completion_callbacks{$1}->{$2}\n";
140 # print color("reset");
141 delete $completion_callbacks{$1}->{$2};
145 $rc = /client blocking AST callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
146 $blocking_callbacks{$1}->{$2} = $3;
147 # print color("white");
148 # print "---BL CB START: $1 $2\n";
149 # print color("reset");
151 $rc = /client blocking callback handler END ns: (.*) lock: (.*) lrc: (.*) mode/;
153 # print color("white");
154 # print "---BL CB END: $1 $2 $3 deleting $blocking_callbacks{$1}->{$2}\n";
155 # print color("reset");
156 delete $blocking_callbacks{$1}->{$2};
159 $rc = /ldlm_lock_addref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
160 # print color("white");
161 # print "------>addref ns: $1 lock: $2 lrc: $3\n" if ($rc);
162 # print color("reset");
163 $locks{$1}->{$2} = {$3} if ($rc);
164 $rc = /ldlm_lock_decref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
165 # print color("white");
166 # print "------>decref ns: $1 lock: $2 lrc: $3\n" if ($rc);
167 # print color("reset");
168 $locks{$1}->{$2} = {$3} if ($rc);
176 foreach (keys %completion_callbacks) {
179 foreach (keys %{$completion_callbacks{$ns}}) {
181 print "Unfinished completions in ns $ns: \n";
184 print " lock: $_ lrc: $completion_callbacks{$ns}->{$_}\n";
187 foreach (keys %blocking_callbacks) {
190 foreach (keys %{$blocking_callbacks{$ns}}) {
192 print "Unfinished blocking in ns $ns: \n";
195 printf(" lock: $_ lrc: %s\n", $blocking_callbacks{$ns}->{$_});
206 $rc = /D_IT UP dentry (.*) fsdata/;
207 delete $it{$1} if ($rc);
208 $rc = /D_IT DOWN dentry (.*) fsdata/;
209 $it{$1} = "yes" if ($rc);
212 sub unmatched_intents {
216 print "Unmatched intents: \n";
224 $linepid = extractpid($_);
225 $linehpid = extracthostpid($_);
226 $linemask = getmask($_);
227 $linesubsys = getsubsys($_);
229 # printf "---> mask %x subsys %x\n", $linemask, $linesubsys;
232 chop $prefix->{$linepid};
233 chop $prefix->{$linepid};
236 if ($linemask == $masks->{DENTRY}) {
239 if ($linemask == $masks->{DLMTRACE}) {
243 if ( !$pid || $linepid == $pid || $linehpid == $pid) {
244 next if ($rpctrace && $linemask != $masks->{RPCTRACE});
245 next if ($trace && $linemask != $masks->{TRACE});
249 ( $linesubsys == $subsys->{LDLM}));
251 ( $linesubsys == $subsys->{CLASS}));
254 ( $linesubsys == $subsys->{RPC} ||
255 $linesubsys == $subsys->{NET} ||
256 $linesubsys == $subsys->{PORTALS} ||
257 $linesubsys == $subsys->{SOCKNAL} ||
258 $linesubsys == $subsys->{QSWNAL} ||
259 $linesubsys == $subsys->{GMNAL}));
262 # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_);
265 printf("%s%s", $prefix->{$linepid}, $_);
266 print color("reset");
268 # last if $count++ > 100;
271 $prefix->{$linepid} .= ' ';
278 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);