#!/usr/bin/perl # Parse the log output files of run-experiment # Send concatenated log files to stdin, or list them on the command # line. use strict; my $mode = ''; my $depth = 0; my $who = 0; my $what = ''; my $setupsize = 0; my $opsize = 0; my @seconds = (0, 0); my $netsetup = ''; while(<>) { chomp; if (/Network setup: (.*)/) { $netsetup = "$1 "; next; } if (/===== Running floram (\S+) (\d+)/) { $mode = $1; $depth = $2; @seconds = (0,0); $what = ''; $setupsize = 0; $opsize = 0; next; } if (/===== P([01]) output/) { $who = $1; next; } if (/ORAM ACCESS \(SETUP/) { $what = 'SETUP'; next; } if (/ORAM ACCESS \(READ|WRITE/) { $what = 'OP'; next; } if (/Total time: (\d+\.?\d*) s/) { $seconds[$who] = $1; next; } if (/^\d+,8,/) { my @F = split(/,/); my @sizes = (); my $i; for ($i=4;$i<=$#F;$i+=3) { push(@sizes, $F[$i]); } if ($what eq '') { die "Unrecognized data line\n"; } if ($what eq 'SETUP') { $setupsize += $sizes[0]; } else { foreach (@sizes) { $opsize += $_; } } } $what = ''; if (/===== End/) { my $maxsecs = $seconds[0]; $maxsecs = $seconds[1] if $seconds[1] > $maxsecs; print "Floram $mode $depth $netsetup$maxsecs s\n"; # The setupsize and opsize are the _sum_ for the two parties, so # add them to get the total size for both parties, and divide by # 2 to get the average size for each party my $bytes = ($setupsize + $opsize) / 2; my $kib = $bytes / 1024; print "Floram $mode $depth $netsetup$kib KiB\n"; } }