new2oldctx 565 B

12345678910111213141516171819202122232425262728293031
  1. # Convert the new format:
  2. # Context switch of 8 4k processes: 64.17 (60.02 overhead)
  3. # to the old format:
  4. #"size=0 ovr=22
  5. # 2 8
  6. # 4 14
  7. # 8 18
  8. # 16 21
  9. # 20 22
  10. eval 'exec perl -Ssw $0 "$@"'
  11. if 0;
  12. @lines = grep(/Context switch/, <>);
  13. foreach $size ("0k", "4k", "16k", "32k", "64k") {
  14. @data = grep(/$size/, @lines);
  15. @a = @b = @c = ();
  16. $i = 0;
  17. foreach $n (2, 4, 8, 16, 20) {
  18. @tmp = ();
  19. foreach $_ (grep(/of $n/, @data)) {
  20. @_ = split;
  21. push(@tmp, "$_[3] $_[6]\n");
  22. }
  23. ($a[$i],$b[$i],$c[$i]) = @tmp;
  24. $i++;
  25. }
  26. print "\n\"size=$size \n";
  27. print @c;
  28. }