allctx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Extract the context switching information from lmbench result files.
  2. # Usage: getctx file file....
  3. #
  4. # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com).
  5. # Copyright (c) 1994 Larry McVoy. GPLed software.
  6. # $Id$
  7. eval 'exec perl -Ss $0 "$@"'
  8. if 0;
  9. $first = 1;
  10. foreach $file (@ARGV) {
  11. open(FD, $file);
  12. $file =~ s|.*/||;
  13. $file =~ s/\.\d+//;
  14. while (<FD>) {
  15. chop;
  16. if (/^\[lmbench/) {
  17. split;
  18. if ($_[3] eq "SunOS") {
  19. $_[3] .= "-$_[5]";
  20. }
  21. $uname = "@_";
  22. }
  23. if (/Mhz/) {
  24. $mhz = $_;
  25. }
  26. if (/^.size=/) {
  27. s/size/Process size/;
  28. s/ ovr/\toverhead/;
  29. @info = &getinfo($uname, $mhz);
  30. ($f = $file) =~ s|.*/||;
  31. print "\n" unless $first;
  32. $first = 0;
  33. print "%T $info[3] $info[$#info]Mhz\n";
  34. print "$_\n";
  35. while (<FD>) {
  36. last if /^Null/ || /^Pipe/ || /^Memor/;
  37. next if /\$Id/;
  38. s/ ovr/\toverhead/;
  39. s/size/Process size/;
  40. print ;
  41. }
  42. last;
  43. }
  44. }
  45. }
  46. exit 0;
  47. # Try and create sensible names from uname -a output
  48. sub getinfo
  49. {
  50. local(@info);
  51. local($name);
  52. local($mhz) = sprintf("%.0f", $_[1]);
  53. @info = split(/\s+/, $_[0]);
  54. $name = pop(@info);
  55. chop($name);
  56. if ($name eq "mips") {
  57. $name = "$info[$#info]@$mhz";
  58. } elsif ($_[0] =~ /HP-UX/) {
  59. $name = "$info[7]@$mhz";
  60. } elsif ($_[0] =~ /SunOS/) {
  61. $name = "$info[7]@$mhz";
  62. } else {
  63. $name .= "@$mhz";
  64. }
  65. push(@info, $name);
  66. @info;
  67. }