allmem 1.3 KB

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