Преглед изворни кода

Parse the output of Floram run-experiments to get the bandwidths used

Ian Goldberg пре 1 година
родитељ
комит
902e676487
1 измењених фајлова са 60 додато и 0 уклоњено
  1. 60 0
      parse_sizes

+ 60 - 0
parse_sizes

@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $mode = '';
+my $depth = 0;
+my $what = '';
+my $setupsize = 0;
+my $opsize = 0;
+
+while(<>) {
+    chomp;
+    if (/===== Running floram (\S+) (\d+)/) {
+        $mode = $1;
+        $depth = $2;
+        $what = '';
+        $setupsize = 0;
+        $opsize = 0;
+        next;
+    }
+    if (/ORAM ACCESS \(SETUP/) {
+        $what = 'SETUP';
+        next;
+    }
+    if (/ORAM ACCESS \(READ|WRITE/) {
+        $what = 'OP';
+        next;
+    }
+    if (/,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];
+        } elsif ($#sizes == 0) {
+            $opsize += 128 * $sizes[0];
+        } elsif ($#sizes == 1) {
+            $opsize += $sizes[0] + 127 * $sizes[1];
+        } elsif ($#sizes == 127) {
+            foreach (@sizes) { $opsize += $_; }
+        } else {
+            die "Bad number of data points\n";
+        }
+    }
+    $what = '';
+    if (/===== End/) {
+        # 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 "$depth $kib 0\n";
+    }
+}