logparse.pl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/perl
  2. use strict;
  3. my %workingon = ();
  4. my @probmults = ();
  5. my $totMmults = 0;
  6. my @probend = ();
  7. my @Nfiles = ('N-44', 'N-54', 'N-60', 'N-66', 'N-72', 'N-76', 'N-80',
  8. 'N-84', 'N-88');
  9. # Read the moduli for each of the subproblems
  10. my @moduli = (0);
  11. my $f;
  12. for (1..20) {
  13. foreach $f (@Nfiles) {
  14. open(N, $f);
  15. while(<N>) {
  16. if (/^\[(\d+\s*)+\]/) {
  17. while(/(\d+)/g) {
  18. push @moduli, $1;
  19. }
  20. }
  21. }
  22. close(N);
  23. push @probend, [$#moduli, $f];
  24. }
  25. }
  26. while(<>) {
  27. chomp;
  28. next unless /^(\d+\.\d+):(.*?):(.*)$/;
  29. my ($ts, $node, $line) = ($1,$2,$3);
  30. if ($line =~ /Subproblem (\d+)/) {
  31. $workingon{$node} = $1;
  32. }
  33. if ($line =~ /(\d+) us \/ (\d+) = \d+ us \/ (\d+) = \d+ ns/) {
  34. my $numMmults = $2 * $3 / 1000000;
  35. my $elapsed = $1;
  36. if ($workingon{$node} > 0) {
  37. $probmults[$workingon{$node}] += $numMmults;
  38. $totMmults += $numMmults;
  39. $workingon{$node} = 0;
  40. } else {
  41. warn "Node $node completed at $ts but not working\n";
  42. }
  43. }
  44. }
  45. my $p;
  46. my $tpm = 0;
  47. for ($p=1; $p <= $#probmults; ++$p) {
  48. my $m = $probmults[$p];
  49. $tpm += $m;
  50. my $r = $moduli[$p];
  51. my $lr = int(log($r)/log(2))+1;
  52. my $l = log($m*1000000)/log(2);
  53. my $k = $m*1000000/sqrt($r);
  54. printf "%4d %15.1f Mmults = 2^%.1f = %10.2f * sqrt(r_%d)\n",
  55. $p, $m, $l, $k, $lr;
  56. if ($p == $probend[0]->[0]) {
  57. printf "\n%4s %15.1f Mmults = 2^%.1f\n\n", $probend[0]->[1],
  58. $tpm, log($tpm*1000000)/log(2);
  59. $tpm = 0;
  60. shift @probend;
  61. }
  62. }
  63. printf "\n tot %15.1f Mmults = 2^%.1f\n",
  64. $totMmults, log($totMmults*1000000)/log(2);