|
|
@ -5,29 +5,41 @@ use strict; |
|
|
|
sub loadFile { |
|
|
|
sub loadFile { |
|
|
|
my ($file) = @_; |
|
|
|
my ($file) = @_; |
|
|
|
my %ret; |
|
|
|
my %ret; |
|
|
|
my $min = 100000000; |
|
|
|
my $max = 0; |
|
|
|
open FILE,$file; |
|
|
|
open FILE,$file; |
|
|
|
while (<FILE>) { |
|
|
|
while (<FILE>) { |
|
|
|
my ($addr,$p2h,$p8h,$p1d,$p1w,$p1m) = split(/\s+/,$_); |
|
|
|
my ($addr,$p2h,$p8h,$p1d,$p1w,$p1m) = split(/\s+/,$_); |
|
|
|
if ($p1m =~ /\A([1-9.]+)%\Z/) { |
|
|
|
if ($p1m =~ /\A([1-9.]+)%\Z/) { |
|
|
|
my $x = log($1*0.01)/log(0.5); |
|
|
|
my $x = $1*0.01; |
|
|
|
$min=$x if ($x < $min); |
|
|
|
$max=$x if ($x > $max); |
|
|
|
$ret{$addr} = $x; |
|
|
|
$ret{$addr} = $x; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for my $k (keys %ret) { |
|
|
|
for my $k (keys %ret) { |
|
|
|
$ret{$k} -= $min; |
|
|
|
$ret{$k} /= $max; |
|
|
|
} |
|
|
|
} |
|
|
|
close FILE; |
|
|
|
close FILE; |
|
|
|
return \%ret; |
|
|
|
return \%ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub merge { |
|
|
|
|
|
|
|
my ($a,$b) = @_; |
|
|
|
|
|
|
|
return 1-(1-$a)*(1-$b); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub combine { |
|
|
|
sub combine { |
|
|
|
my ($f1,$f2) = @_; |
|
|
|
my ($f1,$f2) = @_; |
|
|
|
my %ret; |
|
|
|
my %ret; |
|
|
|
for my $k1 (keys %{$f1}) { |
|
|
|
for my $k1 (keys %{$f1}) { |
|
|
|
if (defined $f2->{$k1}) { |
|
|
|
if (defined $f2->{$k1}) { |
|
|
|
$ret{$k1} = $f1->{$k1} + $f2->{$k1}; |
|
|
|
$ret{$k1} = merge($f1->{$k1}, $f2->{$k1}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$ret{$k1} = merge($f1->{$k1}, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for my $k2 (keys %{$f2}) { |
|
|
|
|
|
|
|
if (!defined $f1->{$k2}) { |
|
|
|
|
|
|
|
$ret{$k2} = merge(0, $f2->{$k2}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return \%ret; |
|
|
|
return \%ret; |
|
|
@ -45,9 +57,9 @@ for my $file (@ARGV) { |
|
|
|
$n++; |
|
|
|
$n++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for my $addr (sort { $res->{$a} <=> $res->{$b} } (keys %{$res})) { |
|
|
|
for my $addr (sort { $res->{$b} <=> $res->{$a} } (keys %{$res})) { |
|
|
|
if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):8333/) { |
|
|
|
if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):8333/) { |
|
|
|
my $a = $1*0x1000000 + $2*0x10000 + $3*0x100 + $4; |
|
|
|
my $a = $1*0x1000000 + $2*0x10000 + $3*0x100 + $4; |
|
|
|
printf "0x%08x %s %g%%\n",$a,$addr,exp(log(0.5)*$res->{$addr}/$n)*100; |
|
|
|
printf "0x%08x %s %g%%\n",$a,$addr,(1-((1-$res->{$addr}) ** (1/$n)))*100; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|