parse_times 558 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/perl
  2. use strict;
  3. my $mode = '';
  4. my $depth = 0;
  5. my $who = 0;
  6. my @seconds = (0, 0);
  7. while(<>) {
  8. chomp;
  9. if (/===== Running floram (\S+) (\d+)/) {
  10. $mode = $1;
  11. $depth = $2;
  12. @seconds = (0,0);
  13. next;
  14. }
  15. if (/===== P([01]) output/) {
  16. $who = $1;
  17. next;
  18. }
  19. if (/Total time: (\d+\.?\d*) s/) {
  20. $seconds[$who] = $1;
  21. }
  22. if (/===== End/) {
  23. my $maxsecs = $seconds[0];
  24. $maxsecs = $seconds[1] if $seconds[1] > $maxsecs;
  25. print "$depth $maxsecs\n";
  26. }
  27. }