commsfwtools/commstools/svg/listitf.pl
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 # Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 #
       
    15 
       
    16 use strict;
       
    17 
       
    18 use Getopt::Long;
       
    19 my $incPersist = 0;
       
    20 my $incLastSeen = 1;
       
    21 GetOptions('persist!' => \$incPersist, 'lastseen!' => \$incLastSeen);
       
    22 
       
    23 my %regs;
       
    24 my %persistItf;
       
    25 my %lastSeen;
       
    26 while(<>)
       
    27 {
       
    28   if($_ =~ /\s+(W\d+): RegisterItf\(([0-9a-fA-F]+)/)
       
    29   {
       
    30     my $key = "$1: $2";
       
    31     $regs{$key} = [ "(#$.)", $. ];
       
    32   }
       
    33   elsif($_ =~ /\s+(W\d+): DeregisterItf\(([0-9a-fA-F]+)/)
       
    34   {
       
    35     my $key = "$1: $2";
       
    36     delete $regs{$key};
       
    37   }
       
    38   elsif($_ =~ /\s+(W\d+): (.+):\s+created \[MCFNode ([0-9a-fA-F]+)/)
       
    39   {
       
    40     my $key = "$1: $3";
       
    41     $regs{$key} = ["$2 (#$.)", $.] if defined($regs{$key});
       
    42   }
       
    43   elsif($_ =~ /CSockManData::AddPersistentItf\(([0-9a-fA-F]+)\)\s+\[#(\d+)\]/)
       
    44   {
       
    45     $persistItf{$1} = $2;
       
    46   }
       
    47   elsif($incLastSeen && $_ =~ /TCFSignatureBase:\tDispatchL\(\): Sender=([0-9a-fA-F]+), Recipient=([0-9a-fA-F]+), Message=(.+), Activity=/)
       
    48   {
       
    49 	$lastSeen{$1} = [$3, $.];
       
    50 	$lastSeen{$2} = [$3, $.];
       
    51   }
       
    52 }
       
    53 
       
    54 my @keys = sort { $regs{$a}->[1] <=> $regs{$b}->[1] } keys %regs;
       
    55 for my $key (@keys)
       
    56 {
       
    57   my $persistInfo;
       
    58   if($key =~ /W\d+: ([0-9a-fA-F]+)/)
       
    59   {
       
    60     $persistInfo = $persistItf{$1} if defined($persistItf{$1});
       
    61   }
       
    62   if(!defined($persistInfo) || $incPersist)
       
    63   {
       
    64   	my $lastSeenId;
       
    65   	if($incLastSeen && defined ($lastSeenId = $lastSeen{$1}))
       
    66   	{
       
    67 	  $lastSeenId = "#$lastSeenId->[1], $lastSeenId->[0]";
       
    68 	}
       
    69     print "$key $regs{$key}->[0]";
       
    70     print " (last seen $lastSeenId)" if defined($lastSeenId);
       
    71     print " (persistent #$persistInfo)" if defined($persistInfo);
       
    72     print "\n";
       
    73   }
       
    74 }
       
    75