rwlock.pl 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/perl
  2. my $start = 8;
  3. my $i = $start;
  4. my $step = "4";
  5. my $wr = 0;
  6. printf "%s %0.4d START $list[4]\n", " " x $i, $i;
  7. while(<>) {
  8. my $sub = 0;
  9. my $indent = 0;
  10. next unless /ERR/;
  11. @list = split;
  12. if ($list[9] eq "ACQUIRED") {
  13. if ($list[7] eq "Read") {
  14. $mark = "READLOCK ";
  15. $i += $step;
  16. $indent = $i;
  17. } else {
  18. $mark = "WRITELOCK";
  19. $wr = 1;
  20. $indent = 0;
  21. }
  22. } elsif($list[9] eq "CLEARED") {
  23. if ($wr && $i <= $start) {
  24. $mark = "WRCLEARED";
  25. $indent = 0;
  26. } else {
  27. $sub = $step;
  28. $mark = "CLEARED ";
  29. $indent = $i;
  30. }
  31. } elsif($list[9] eq "FAIL") {
  32. $mark = "FAIL ";
  33. $indent = $i;
  34. }
  35. printf "%s %0.4d $mark $list[4]\n", " " x $indent, $indent;
  36. if ($sub) {
  37. $i -= $sub;
  38. $sub = 0;
  39. print "\n";
  40. }
  41. }