~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/script/find_auth_pins.pl

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
my %pin;
 
4
my %hist;     
 
5
my $l = 1;
 
6
my @pins;
 
7
while (<>) {
 
8
 
 
9
        #cdir:adjust_nested_auth_pins on [dir 163 /foo/ rep@13 | child] count now 0 + 1
 
10
 
 
11
        if (/adjust_nested_auth_pins/) {
 
12
                my ($what) = / (\w+)\]/;
 
13
                $what =~ s/ 0x/ /;
 
14
                $hist{$what} .= "$l: $_"
 
15
                        if defined $pin{$what};
 
16
        }
 
17
 
 
18
        # cinode:auth_pin on inode [1000000002625 /gnu/blah_client_created. 0x89b7700] count now 1 + 0
 
19
 
 
20
        elsif (/auth_pin / && !/waiting/) {
 
21
                #my ($what) = /\[(\w+ \w+) /;
 
22
                my ($what) = / (\w+)\]/;
 
23
                $what =~ s/ 0x/ /;
 
24
                #print "$_ add_waiter $c $what\n";
 
25
                $pin{$what}++;
 
26
                $hist{$what} .= "$l: $_";
 
27
                push( @pins, $what ) unless grep {$_ eq $what} @pins;
 
28
        }
 
29
 
 
30
        # cinode:auth_unpin on inode [1000000002625 (dangling) 0x89b7700] count now 0 + 0
 
31
 
 
32
        elsif (/auth_unpin/) {
 
33
                #my ($what) = /\[(\w+ \w+) /;# / on (.*\])/;
 
34
                my ($what) = / (\w+)\]/;
 
35
                $what =~ s/ 0x/ /;
 
36
                $pin{$what}--;
 
37
                $hist{$what} .= "$l: $_";
 
38
                unless ($pin{$what}) {
 
39
                        delete $hist{$what};
 
40
                        delete $pin{$what};
 
41
                        @pins = grep {$_ ne $what} @pins;
 
42
                }
 
43
        }
 
44
        $l++;
 
45
}
 
46
 
 
47
for my $what (@pins) {
 
48
        print "---- count $pin{$what} on $what
 
49
$hist{$what}
 
50
";
 
51
}