]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Better support for things with shared locks that can be opened many times,
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 29 Jul 2013 00:46:55 +0000 (18:46 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 29 Jul 2013 00:46:55 +0000 (18:46 -0600)
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).

scripts/find-alive.pl

index 8295922bcedecbd79deadb446cd64532c378554e..54263f37e17e4c2ff18f7de825a593ea481084cd 100755 (executable)
@@ -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 (<STDIN>) {
-       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);