Last active
November 7, 2019 19:24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
my $threshold = 5; | |
sub count { | |
my $f = shift; | |
my %data; | |
while(<$f>) { | |
next unless /\-\>/; | |
if (/\[([0-9.]+)s\]/) { | |
my $n = (split / /)[0]; | |
my $t = $1; | |
$data{$n} = $t; | |
} | |
} | |
%data; | |
} | |
open(my $f1, "<$ARGV[0]") or die; | |
open(my $f2, "<$ARGV[1]") or die; | |
my %data1 = count($f1); | |
my %data2 = count($f2); | |
my @result; | |
while (my ($n, $t1) = each %data1) { | |
next if not exists $data2{$n}; | |
my $t2 = $data2{$n}; | |
my $d = $t2 - $t1; | |
if ($d > $threshold) { | |
push @result, [$d, $n, $t1, $t2]; | |
} | |
} | |
foreach my $i (sort { $b->[0] <=> $a->[0] } @result) { | |
my ($d, $n, $t1, $t2) = splice @$i; | |
print "$n :\n"; | |
print " $t1 <-> $t2\n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment