getresults 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/usr/bin/perl -ws
  2. # Search through the archives splitting out stuff that has pathnames.
  3. while (1) {
  4. &headers;
  5. &body;
  6. }
  7. sub headers
  8. {
  9. while (<>) {
  10. warn "HDR $_" if ($debug);
  11. return if /^\s*$/;
  12. }
  13. exit;
  14. }
  15. # Save the info for the system, skipping everything ig there is no info.
  16. sub body
  17. {
  18. @info = ();
  19. while (<>) {
  20. last if m|^[-]+ \.\./results|;
  21. last if /^\[lmbench/;
  22. if (/^From[: ]/) { warn "FROM $_"; return; }
  23. warn "INFO $_" if ($debug);
  24. push(@info, $_);
  25. }
  26. if (/^[-]+ \.\.\/results/) {
  27. @foo = split;
  28. $path = $foo[1];
  29. $path =~ s|\.\./||;
  30. warn "PATH $path\n" if ($debug);
  31. &results;
  32. return;
  33. }
  34. warn "SKIPPING one\n";
  35. while (<>) {
  36. warn "SKIP $_" if ($SKIP);
  37. last if /^Memory load latency/;
  38. if (/^From[: ]/) { warn "FROM $_"; return; }
  39. }
  40. die "No memory load latency" unless /^Memory load latency/;
  41. while (<>) {
  42. warn "SKIP $_" if ($SKIP);
  43. last if /^\[/;
  44. if (/^From[: ]/) { warn "FROM $_"; return; }
  45. }
  46. die "No date" unless /^\[/;
  47. while (<>) {
  48. last unless /^\s*$/;
  49. if (/^From[: ]/) { warn "FROM $_"; return; }
  50. }
  51. }
  52. sub results
  53. {
  54. @results = ();
  55. while (<>) {
  56. goto done if (/^From[: ]/);
  57. warn "RES $_" if ($RES);
  58. push(@results, $_);
  59. last if /^Memory load latency/;
  60. }
  61. die "No memory load latency" unless /^Memory load latency/;
  62. while (<>) {
  63. goto done if (/^From[: ]/);
  64. warn "RES $_" if ($RES);
  65. push(@results, $_);
  66. last if /^\[/;
  67. }
  68. die "No date" unless /^\[/;
  69. while (<>) {
  70. last unless /^\s*$/;
  71. }
  72. done:
  73. ($dir = $path) =~ s|/[^/]+$||;
  74. warn "DIR $dir\n" if ($debug);
  75. system "mkdir -p $dir";
  76. if (-e $path) {
  77. warn "CONFLICT on $path\n" if $debug;
  78. for ($i = 0; ; $i++) {
  79. $tmp = "${path}.${i}";
  80. last if ! -e $tmp;
  81. warn "CONFLICT on $tmp\n" if $debug;
  82. }
  83. $path = $tmp;
  84. }
  85. $info = $path . ".INFO";
  86. open(O, ">$info");
  87. print O @info;
  88. close(O);
  89. warn "Saving $path\n" if $verbose;
  90. open(O, ">$path");
  91. print O @results;
  92. close(O);
  93. }