From: Alex Rousskov Date: Mon, 29 Jul 2013 00:46:55 +0000 (-0600) Subject: Better support for things with shared locks that can be opened many times, X-Git-Tag: SQUID_3_5_0_1~444^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01aed79c466257a5c7c5ee0104224bd2d4107724;p=thirdparty%2Fsquid.git Better support for things with shared locks that can be opened many times, such as Ipc::StoreMap entries. Maintain a lock counter instead of boolean opened flag. Better support for things with multipart IDs such as Ipc::StoreMap entries that have an anchor/inode ID and map name. Support searching for shared pages (sh_page). --- diff --git a/scripts/find-alive.pl b/scripts/find-alive.pl index 8295922bce..54263f37e1 100755 --- a/scripts/find-alive.pl +++ b/scripts/find-alive.pl @@ -56,8 +56,12 @@ my %Pairs = ( 'fd_close\s+FD (\d+)', ], IpcStoreMapEntry => [ - 'StoreMap.* opened .*entry (\d+)', - 'StoreMap.* closed .*entry (\d+)', + 'StoreMap.* opened .*entry (\d+) for \S+ (\S+)', + 'StoreMap.* closed .*entry (\d+) for \S+ (\S+)', + ], + sh_page => [ + 'PageStack.* pop: (sh_page\S+) at', + 'PageStack.* push: (sh_page\S+) at', ], ); @@ -74,29 +78,32 @@ die("unsupported Thing, stopped") unless $Pairs{$Thing}; my $reConstructor = $Pairs{$Thing}->[0]; my $reDestructor = $Pairs{$Thing}->[1]; -my %Alive = (); +my %AliveCount = (); +my %AliveImage = (); my $Count = 0; while () { - if (/$reConstructor/) { - #die($_) if $Alive{$1}; - $Alive{$1} = $_; - ++$Count; + if (my @conIds = (/$reConstructor/)) { + my $id = join(':', @conIds); + #die($_) if $Alive{$id}; + $AliveImage{$id} = $_; + ++$Count unless $AliveCount{$id}++; } - elsif (/$reDestructor/) { - #warn("unborn: $_") unless $Alive{$1}; - $Alive{$1} = undef(); + elsif (my @deIds = (/$reDestructor/)) { + my $id = join(':', @deIds); + #warn("unborn: $_") unless $AliveCount{$id}; + $AliveImage{$id} = undef() unless --$AliveCount{$id}; } } printf(STDERR "Found %d %s\n", $Count, $Thing); -my $AliveCount = 0; -foreach my $alive (sort grep { defined($_) } values %Alive) { +my $aliveCount = 0; +foreach my $alive (sort grep { defined($_) } values %AliveImage) { next unless defined $alive; printf("Alive: %s", $alive); - ++$AliveCount; + ++$aliveCount; } -printf(STDERR "found %d still-alive %s\n", $AliveCount, $Thing); +printf(STDERR "found %d still-alive %s\n", $aliveCount, $Thing); exit(0);