#!/usr/bin/perl

use strict;

my $size = 0;
my $who = '';
my $mode = '';
my %res = ();

while(<>) {
    $size = $1 if /===== Running oram (\d+) 128/;
    $res{$size} = {} unless defined $res{$size};
    $who = $1 if /===== ([CDE]) output/;
    $mode = $1 if /(Online Time|ETE)/;
    $res{$size}->{$who.$mode} = $1/1000 if /WC\(ms\): (\d+)/;
}

sub max3 {
    my $m = $_[0];
    $m = $_[1] if $_[1] > $m;
    $m = $_[2] if $_[2] > $m;
    $m;
}

print "#size online_secs total_secs\n";
foreach $size (sort {$a <=> $b} keys %res) {
    my $online = &max3($res{$size}->{'COnline Time'},
        $res{$size}->{'DOnline Time'},
        $res{$size}->{'EOnline Time'});
    my $total = &max3($res{$size}->{'CETE'},
        $res{$size}->{'DETE'},
        $res{$size}->{'EETE'});
    print "$size $online $total\n";
}
