36 # 1 include client IPC requests |
36 # 1 include client IPC requests |
37 # 2 include client IPC completions (async requests only) |
37 # 2 include client IPC completions (async requests only) |
38 # 4 include ESOCK session creation |
38 # 4 include ESOCK session creation |
39 # 8 display activity name along with each tuple line (e.g. "(IpCprNoBearer) (CoreNetStates::TSendBindTo, CoreNetStates::TAwaitingBindToComplete)") |
39 # 8 display activity name along with each tuple line (e.g. "(IpCprNoBearer) (CoreNetStates::TSendBindTo, CoreNetStates::TAwaitingBindToComplete)") |
40 # 16 display AddClient/RemoveClient operations |
40 # 16 display AddClient/RemoveClient operations |
|
41 # -o <path> Write HTML and SVG output files into directory <path> |
41 |
42 |
42 use strict; |
43 use strict; |
43 |
44 |
44 require 'getopts.pl'; |
45 require 'getopts.pl'; |
45 |
46 |
46 my $version = "2.1 (24/02/09)"; |
47 my $version = "2.2 (16/04/10)"; |
47 |
48 |
48 # |
49 # |
49 # Internal Options |
50 # Internal Options |
50 # |
51 # |
51 # BUG BEWARE: A timestamp or milestone displayed on lefthand side overwrites any fast count delta that would have been displayed there |
52 # BUG BEWARE: A timestamp or milestone displayed on lefthand side overwrites any fast count delta that would have been displayed there |
52 my $fastCount = 0; # Add fast count delta on lefthand side. |
53 my $fastCount = 0; # Add fast count delta on lefthand side. |
53 |
54 |
54 my $globalIndex = 1; |
55 my $globalIndex = 1; |
55 my $lifeStage = 0; # 0 = not running or shutting down, 1 = during boot, 2 = main phase |
56 my $lifeStage = 0; # 0 = not running or shutting down, 1 = during boot, 2 = main phase |
56 |
57 my $outputPath = ""; # path to output directory specified by "-o" |
57 |
58 |
58 our($opt_p,$opt_s,$opt_x,$opt_X); |
59 our($opt_p,$opt_s,$opt_x,$opt_X, $opt_o); |
59 |
60 |
60 Getopts("ps:x:X:"); |
61 Getopts("ps:x:X:o:"); |
61 |
62 |
|
63 $outputPath = processPathArgument($opt_o); |
62 |
64 |
63 ### to get 1st line of latest log: type log.txt | perl -e "while(<>){if(/^#Logging started/){$a=$.;print $a.' '}};print $a" |
65 ### to get 1st line of latest log: type log.txt | perl -e "while(<>){if(/^#Logging started/){$a=$.;print $a.' '}};print $a" |
64 |
66 |
65 # |
67 # |
66 # objectNameParse is an array of hashes used to shorten class names and specify left-to-right |
68 # objectNameParse is an array of hashes used to shorten class names and specify left-to-right |
81 # Variables/constants concerned with Arguments file. |
83 # Variables/constants concerned with Arguments file. |
82 # |
84 # |
83 |
85 |
84 use constant ArgumentSignedDecimal => 0; |
86 use constant ArgumentSignedDecimal => 0; |
85 use constant ArgumentNode => 1; |
87 use constant ArgumentNode => 1; |
86 my %argumentFormatToConstant = ( "node" => ArgumentNode ); # used to have several other options |
88 use constant ArgumentHex => 2; |
|
89 my %argumentFormatToConstant = ( "node" => ArgumentNode, "x" => ArgumentHex ); # used to have several other options |
87 my %arguments; |
90 my %arguments; |
88 |
91 |
89 # Support for AddClient/RemoveClient |
92 # Support for AddClient/RemoveClient |
90 my %clients; |
93 my %clients; |
91 my %clientTypeToDirection = ( "100" => "<", "200" => "^", "400" => "v", "800" => ">"); |
94 my %clientTypeToDirection = ( "100" => "<", "200" => "^", "400" => "v", "800" => ">"); |
315 print "ad $session\n"; |
318 print "ad $session\n"; |
316 } |
319 } |
317 } |
320 } |
318 elsif (($opt_s & 2) && |
321 elsif (($opt_s & 2) && |
319 (/CWorkerSubSession\(.{8}\):\s*CompleteMessage\((.{8})\) with (.+), session .{8}/ || |
322 (/CWorkerSubSession\(.{8}\):\s*CompleteMessage\((.{8})\) with (.+), session .{8}/ || |
|
323 /~CESockClientActivityBase..{8}.\s*RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || |
|
324 /RSafeMessage\(.{8}\)::Complete\((.{8})\) with ([-\d]+)/)) |
|
325 { |
320 # /ProcessMessageL, session=.{8}, RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || |
326 # /ProcessMessageL, session=.{8}, RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || |
321 /~CESockClientActivityBase..{8}.\s*RMessage2::Complete \((.{8})\) with ([-\d]+)\./ || |
|
322 /RSafeMessage\((.{8})\)::Complete\((\d+)\) - session .{8}/)) |
|
323 { |
|
324 # W6: CPlayer: ProcessMessageL, session=0be839a8, RMessage2::Complete (00de5538) with 0. |
327 # W6: CPlayer: ProcessMessageL, session=0be839a8, RMessage2::Complete (00de5538) with 0. |
325 # W0: CWorkerSubSession(0c941bc4): CompleteMessage(00de1a6c) with -3, session 0be839a8. |
328 # W0: CWorkerSubSession(0c941bc4): CompleteMessage(00de1a6c) with -3, session 0be839a8. |
326 # W6: ~CESockClientActivityBase=0c941f8c, RMessage2::Complete (00de5538) with 0. |
329 # W6: ~CESockClientActivityBase=0c941f8c, RMessage2::Complete (00de5538) with 0. |
|
330 # RSafeMessage(00e01590)::Complete(cd21cb80) with -36 |
327 |
331 |
328 my $msgAddr = $1; |
332 my $msgAddr = $1; |
329 my $ret = $2; |
333 my $ret = $2; |
330 my $exe = $msgAddrToExe{$msgAddr}; |
334 my $exe = $msgAddrToExe{$msgAddr}; |
331 my $ipc = $msgAddrToIpc{$msgAddr}; |
335 my $ipc = $msgAddrToIpc{$msgAddr}; |
790 } elsif ($value =~ m/^0x[0-9a-fA-F]+$/ || $value =~ m/^[\-\d]\d+$/) { |
794 } elsif ($value =~ m/^0x[0-9a-fA-F]+$/ || $value =~ m/^[\-\d]\d+$/) { |
791 # hex or decimal number - convert to signed decimal |
795 # hex or decimal number - convert to signed decimal |
792 if ($value =~ m/^0x/) { |
796 if ($value =~ m/^0x/) { |
793 $value = hex($value); |
797 $value = hex($value); |
794 } |
798 } |
795 $buf .= sprintf "%d", $value; |
799 if ($format == ArgumentHex) { |
|
800 $buf .= sprintf "0x%x", $value; |
|
801 } else { |
|
802 $buf .= sprintf "%d", $value; |
|
803 } |
796 } else { |
804 } else { |
797 $buf .= $value; |
805 $buf .= $value; |
798 } |
806 } |
799 } |
807 } |
800 return $buf; |
808 return $buf; |
932 sub truncateExeName($) |
940 sub truncateExeName($) |
933 { |
941 { |
934 my ($exeName) = @_; |
942 my ($exeName) = @_; |
935 $exeName =~ s/\.exe$//; |
943 $exeName =~ s/\.exe$//; |
936 $exeName =~ s/\.EXE$//; |
944 $exeName =~ s/\.EXE$//; |
|
945 $exeName =~ s/ /_/g; |
937 return $exeName; |
946 return $exeName; |
938 } |
947 } |
939 |
948 |
940 sub outputSymbols() |
949 sub outputSymbols() |
941 { |
950 { |
942 open SYM, ">logsym.html" || die "Cannot open logsym.html for writing\n"; |
951 # Should have already created $outputPath directory, create html/ subdirectory. |
|
952 my $path = $outputPath . "html"; |
|
953 if (! -d $path) { |
|
954 mkdir $path; |
|
955 } |
|
956 $path .= "/logsym.html"; |
|
957 open SYM, ">$path" || die "Cannot open $path for writing\n"; |
943 print SYM "<html>\n<body><code>\n"; |
958 print SYM "<html>\n<body><code>\n"; |
944 my @keys = sort keys %symtab; |
959 my @keys = sort keys %symtab; |
945 for my $i (@keys) { |
960 for my $i (@keys) { |
946 print SYM "$i\t$symtab{$i}<br>\n"; |
961 print SYM "$i\t$symtab{$i}<br>\n"; |
947 } |
962 } |