~measurement-factory/squid/bag5

« back to all changes in this revision

Viewing changes to scripts/find-alive.pl

  • Committer: Alex Rousskov
  • Date: 2013-08-16 15:40:14 UTC
  • mfrom: (12501.2.58 collapsed-fwd)
  • Revision ID: rousskov@measurement-factory.com-20130816154014-od2kncs1egeerazs
Merged from collapsed-fwd (r12587) to get initial Collapsed Forwarding
support and Large Rock/Store fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
                'fd_close\s+FD (\d+)',
57
57
        ],
58
58
        IpcStoreMapEntry => [
59
 
                'StoreMap.* opened .*entry (\d+)',
60
 
                'StoreMap.* closed .*entry (\d+)',
 
59
                'StoreMap.* opened .*entry (\d+) for \S+ (\S+)',
 
60
                'StoreMap.* closed .*entry (\d+) for \S+ (\S+)',
 
61
        ],
 
62
        sh_page => [
 
63
                'PageStack.* pop: (sh_page\S+) at',
 
64
                'PageStack.* push: (sh_page\S+) at',
61
65
        ],
62
66
);
63
67
 
74
78
my $reConstructor = $Pairs{$Thing}->[0];
75
79
my $reDestructor = $Pairs{$Thing}->[1];
76
80
 
77
 
my %Alive = ();
 
81
my %AliveCount = ();
 
82
my %AliveImage = ();
78
83
my $Count = 0;
79
84
while (<STDIN>) {
80
 
        if (/$reConstructor/) {
81
 
                #die($_) if $Alive{$1};
82
 
                $Alive{$1} = $_;
83
 
                ++$Count;
 
85
        if (my @conIds = (/$reConstructor/)) {
 
86
                my $id = join(':', @conIds);
 
87
                #die($_) if $Alive{$id};
 
88
                $AliveImage{$id} = $_;
 
89
                ++$Count unless $AliveCount{$id}++;
84
90
        } 
85
 
        elsif (/$reDestructor/) {
86
 
                #warn("unborn: $_") unless $Alive{$1};
87
 
                $Alive{$1} = undef();
 
91
        elsif (my @deIds = (/$reDestructor/)) {
 
92
                my $id = join(':', @deIds);
 
93
                #warn("unborn: $_") unless $AliveCount{$id};
 
94
                $AliveImage{$id} = undef() unless --$AliveCount{$id};
88
95
        }
89
96
}
90
97
 
91
98
printf(STDERR "Found %d %s\n", $Count, $Thing);
92
99
 
93
 
my $AliveCount = 0;
94
 
foreach my $alive (sort grep { defined($_) } values %Alive) {
 
100
my $aliveCount = 0;
 
101
foreach my $alive (sort grep { defined($_) } values %AliveImage) {
95
102
        next unless defined $alive;
96
103
        printf("Alive: %s", $alive);
97
 
        ++$AliveCount;
 
104
        ++$aliveCount;
98
105
}
99
106
 
100
 
printf(STDERR "found %d still-alive %s\n", $AliveCount, $Thing);
 
107
printf(STDERR "found %d still-alive %s\n", $aliveCount, $Thing);
101
108
 
102
109
exit(0);