getmem 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. foreach $file (@ARGV) {
  9. open(FD, $file);
  10. $file =~ s|/|-|;
  11. while (<FD>) {
  12. chop;
  13. next if m|scripts/lmbench: /dev/tty|;
  14. if (/^\[lmbench/) {
  15. @_ = split;
  16. if ($_[3] eq "SunOS") {
  17. $_[3] .= "-$_[5]";
  18. }
  19. $uname = "@_";
  20. }
  21. if (/Mhz/) {
  22. $mhz = $_;
  23. }
  24. if (/^Memory load latency/) {
  25. @info = &getinfo($uname, $mhz);
  26. ($f = $file) =~ s|.*/||;
  27. print "tmp/mem.$f\n";
  28. open(OUT, ">tmp/mem.$f");
  29. print OUT "\"%X Array size\n\"%Y Latency in nanoseconds\n";
  30. print OUT
  31. "\"%T $file $info[3] $info[$#info] memory latencies\n";
  32. while (<FD>) {
  33. next if /\$Id/;
  34. next if /^\[/;
  35. print OUT;
  36. }
  37. close(OUT);
  38. last;
  39. }
  40. }
  41. }
  42. exit 0;
  43. # Try and create sensible names from uname -a output
  44. sub getinfo
  45. {
  46. local(@info);
  47. local($name);
  48. local($mhz) = $_[1];
  49. $mhz =~ s/\..*//;
  50. $mhz =~ s/ .*//;
  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. }