6 GetOptions("pid=i" => \$pid,
9 "rpctrace!" => \$rpctrace,
11 "dlm_ns=s" => \$dlm_ns,
12 "noclass!" => \$noclass,
14 "extract_start=s" => \$extract_start,
15 "extract_end=s" => \$extract_end);
19 $subsys->{UNDEFINED} = 1 << 0;
20 $subsys->{MDC} = 1 << 1;
21 $subsys->{MDS} = 1 << 2;
22 $subsys->{OSC} = 1 << 3;
23 $subsys->{OST} = 1 << 4;
24 $subsys->{CLASS} = 1 << 5;
25 $subsys->{LOG} = 1 << 6;
26 $subsys->{LLITE} = 1 << 7;
27 $subsys->{RPC} = 1 << 8;
28 $subsys->{MGMT} = 1 << 9;
29 $subsys->{PORTALS} = 1 << 10;
30 $subsys->{SOCKNAL} = 1 << 11;
31 $subsys->{QSWNAL} = 1 << 12;
32 $subsys->{PINGER} = 1 << 13;
33 $subsys->{FILTER} = 1 << 14;
34 $subsys->{PTLBD} = 1 << 15;
35 $subsys->{ECHO} = 1 << 16;
36 $subsys->{LDLM} = 1 << 17;
37 $subsys->{LOV} = 1 << 18;
38 $subsys->{GMNAL} = 1 << 19;
39 $subsys->{PTLROUTER} = 1 << 20;
40 $subsys->{COBD} = 1 << 21;
41 $subsys->{IBNAL} = 1 << 22;
44 $masks->{TRACE} = 1 << 0; # /* ENTRY/EXIT markers */
45 $masks->{INODE} = 1 << 1; #
46 $masks->{SUPER} = 1 << 2; #
47 $masks->{EXT2} = 1 << 3; # /* anything from ext2_debug */
48 $masks->{MALLOC} = 1 << 4; # /* print malloc, free information */
49 $masks->{CACHE} = 1 << 5; # /* cache-related items */
50 $masks->{INFO} = 1 << 6; # /* general information */
51 $masks->{IOCTL} = 1 << 7; # /* ioctl related information */
52 $masks->{BLOCKS} = 1 << 8; # /* ext2 block allocation */
53 $masks->{NET} = 1 << 9; # /* network communications */
54 $masks->{WARNING} = 1 << 10; #
55 $masks->{BUFFS} = 1 << 11; #
56 $masks->{OTHER} = 1 << 12; #
57 $masks->{DENTRY} = 1 << 13; #
58 $masks->{PORTALS} = 1 << 14; # /* ENTRY/EXIT markers */
59 $masks->{PAGE} = 1 << 15; # /* bulk page handling */
60 $masks->{DLMTRACE} = 1 << 16; #
61 $masks->{ERROR} = 1 << 17; # /* CERROR} = ...) == CDEBUG} = D_ERROR, ...) */
62 $masks->{EMERG} = 1 << 18; # /* CEMERG} = ...) == CDEBUG} = D_EMERG, ...) */
63 $masks->{HA} = 1 << 19; # /* recovery and failover */
64 $masks->{RPCTRACE} = 1 << 19; # /* recovery and failover */
70 if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):.*$/) {
79 if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
87 if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
96 if ($line =~ m/(\d+):(\d+):(\d+):(\d+\.\d+):(\d+):(\d+):(\d+):.*$/) {
104 $entering_rpc = /Handling RPC/;
107 $pid = extractpid($_);
115 $leaving_rpc = /Handled RPC/;
125 $entering = /Process entered/;
131 $entering = /Process leaving/;
136 my ($subsys, $mask) = split ":";
142 my ($subsys, $mask) = split ":";
148 my $linemask = shift;
150 if ($linemask == $masks->{TRACE}) {
152 print color("yellow on_black");
154 print color("green on_black");
157 if ($linemask == $masks->{DLMTRACE}) {
158 print color("magenta on_black");
160 if ($linemask == $masks->{DLM}) {
161 print color("magenta on_black");
163 if ($linemask == $masks->{DENTRY}) {
164 print color("red on_black");
173 $rc = /completion callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
175 $completion_callbacks{$1}->{$2} = $3;
176 # print color("white");
177 # print "---CP CB START: $1 $2 $3\n";
178 # print color("reset");
180 $rc = /callback handler finished.* ns: (.*) lock: (.*) lrc: (.*) mode/;
182 # print color("white");
183 # print "---CP CB END: $1 $2 $3 deleting $completion_callbacks{$1}->{$2}\n";
184 # print color("reset");
185 delete $completion_callbacks{$1}->{$2};
189 $rc = /client blocking AST callback handler START ns: (.*) lock: (.*) lrc: (.*) mode/;
190 $blocking_callbacks{$1}->{$2} = $3;
191 # print color("white");
192 # print "---BL CB START: $1 $2\n";
193 # print color("reset");
195 $rc = /client blocking callback handler END ns: (.*) lock: (.*) lrc: (.*) mode/;
197 # print color("white");
198 # print "---BL CB END: $1 $2 $3 deleting $blocking_callbacks{$1}->{$2}\n";
199 # print color("reset");
200 delete $blocking_callbacks{$1}->{$2};
203 $rc = /ldlm_lock_addref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
204 # print color("white");
205 # print "------>addref ns: $1 lock: $2 lrc: $3\n" if ($rc);
206 # print color("reset");
207 $locks{$1}->{$2} = {$3} if ($rc);
208 $rc = /ldlm_lock_decref.*ns: (.*) lock: (.*) lrc: (.*) mode/;
209 # print color("white");
210 # print "------>decref ns: $1 lock: $2 lrc: $3\n" if ($rc);
211 # print color("reset");
212 $locks{$1}->{$2} = {$3} if ($rc);
220 foreach (keys %completion_callbacks) {
223 foreach (keys %{$completion_callbacks{$ns}}) {
225 print "Unfinished completions in ns $ns: \n";
228 print " lock: $_ lrc: $completion_callbacks{$ns}->{$_}\n";
231 foreach (keys %blocking_callbacks) {
234 foreach (keys %{$blocking_callbacks{$ns}}) {
236 print "Unfinished blocking in ns $ns: \n";
239 printf(" lock: $_ lrc: %s\n", $blocking_callbacks{$ns}->{$_});
250 $rc = /D_IT UP dentry (.*) fsdata/;
251 delete $it{$1} if ($rc);
252 $rc = /D_IT DOWN dentry (.*) fsdata/;
253 $it{$1} = "yes" if ($rc);
256 sub unmatched_intents {
260 print "Unmatched intents: \n";
269 print "Usage : llanalyze LOGFILE\n";
274 if(!open(LOG, "<$ARGV[0]")){
275 print "Cannot open $ARGV[0]\n";
286 print "nodlm $nodlm, nonet $nonet, trace $trace\n";
287 print "pid: $pid, dlm_ns: $dlm_ns\n";
288 print "extract_start: $extract_start\n";
289 print "extract_end: $extract_end\n";
291 if ($extract_start && $extract_start != LLANAYZE_FOUND) {
292 next if (index($_, $extract_start, 0) == -1);
293 $extract_start = LLANAYZE_FOUND;
297 next if ($extract_end == LLANAYZE_FOUND);
298 if (index($_, $extract_end, 0) != -1) {
299 $extract_end = LLANAYZE_FOUND;
303 $linepid = extractpid($_);
305 $linehpid = extracthostpid($_);
306 $linesubsys = extractsubsys($_);
307 $linemask = extractmask($_);
310 chop $prefix->{$linepid};
311 chop $prefix->{$linepid};
314 if ($linemask == $masks->{DENTRY}) {
317 if ($linemask == $masks->{DLMTRACE}) {
321 if ( !$pid || $linepid == $pid || $linehpid == $pid) {
322 next if (!$entering_rpc && $rpctrace && $linemask != $masks->{RPCTRACE});
323 next if ($trace && $linemask != $masks->{TRACE});
325 ( $linesubsys == $subsys->{LDLM}));
327 ( $linesubsys != $subsys->{LDLM}));
328 next if (($found_dlm_ns = index( $_, $dlm_ns, 0)) == -1);
330 ( $linesubsys == $subsys->{CLASS}));
332 ( $linesubsys == $subsys->{RPC} ||
333 $linesubsys == $subsys->{NET} ||
334 $linesubsys == $subsys->{PORTALS} ||
335 $linesubsys == $subsys->{SOCKNAL} ||
336 $linesubsys == $subsys->{QSWNAL} ||
337 $linesubsys == $subsys->{IBNAL} ||
338 $linesubsys == $subsys->{GMNAL}));
339 if(!$entering_rpc) {entering_rpc($_);}
340 if(!$leaving_rpc) {leaving_rpc($_);}
342 # printf "sub/mask: %s - %s\n", getsubsys($_), getmask($_);
344 setcolor($linemask, $_);
345 my $string = $prefix->{$linepid}.$_;
347 $string = substr($string, 0, $width)."\n";
349 printf("%s", $string);
350 print color("reset");
352 # last if $count++ > 100;
355 $prefix->{$linepid} .= ' ';
362 # printf "argv %s pid %d\n", $ARGV[0], extractpid($ARGV[0]);