HDBench のデータmycpu.txtを性能順にソートする

perl sort_uniq_mycpu.pl mycpu.txt

# -_-* perl *-_-
use strict;
use utf8;
use Data::Dumper;

$| = 1;

my @lines = <>;
my @datas = ();
my %bak;

@lines = map { chomp; s/^ +//; s/ +$//; $_; } @lines;
while(@lines)
{
	my %topic;
	$topic{Processor} = shift @lines;
	$topic{Integer} = shift @lines;
	$topic{Float} = shift @lines;

	push @datas,\%topic;
}

# print Dumper [\@datas];

print STDERR <<__TEXT;

====================
===  MYCPU.TXT  ====
====================
__TEXT
foreach( sort {
     $$b{Integer} + $$b{Float}
 <=> $$a{Integer} + $$a{Float} } @datas )
{
	next unless( $$_{Integer} );
	next unless( $$_{Float} );
	
	next unless( $$_{Integer} =~ /\d+/ );
	next unless( $$_{Float} =~ /\d+/ );
	
	next if ( $$_{Processor} eq $bak{Processor} 
	     and  $$_{Integer}   eq $bak{Integer} 
	     and  $$_{Float}     eq $bak{Float}   );
	     
	print "$$_{Processor}\n";
	print "$$_{Integer}\n";
	print "$$_{Float}\n";

	%bak = %$_;
}