#!/usr/bin/perl # Find lines that start with Timedat (in any case) # Extract the two numbers after the time data. # Compute speedup rates when all data is collected # Get and store data from file while (<>) { if (/timing\s+(\d+)\s+(\d+(\.\d*))/i) { $count[$1]++; $totalTime[$1]+= $2; } } # The base time is the time for one processor # What if we don't have any data for one processor? Die! die "No data for one processor" if $count[1] == 0; $baseTime = $totalTime[1] / $count[1]; print "1 1.0\n"; # No kidding! # Warning...ugly Perl ahead (it looks like Java!) for ($i = 2; $i <= @count; $i++) { if ($count[$i] > 0) { $average = $totalTime[$i]/$count[$i]; $speedup = $baseTime / $average; print "$i $speedup\n"; } }