getdisk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Extract the disk graph data from lmbench result files.
  2. #
  3. # Hacked into existence by Larry McVoy
  4. # Copyright (c) 1994 Larry McVoy. GPLed software.
  5. # $Id$
  6. eval 'exec perl -Ssw $0 "$@"'
  7. if 0;
  8. foreach $file (@ARGV) {
  9. open(FD, $file);
  10. $file =~ s|/|-|;
  11. while (<FD>) {
  12. next unless /DISK_DESC/;
  13. s/.DISK_DESC: //;
  14. chop; chop; chop;
  15. @_ = split(/[\[\]]/, $_);
  16. foreach $_ (@_) {
  17. next unless /:/;
  18. @foo = split(/:/, $_);
  19. $foo[0] =~ s|/dev/||;
  20. $disks{$foo[0]} = $foo[1];
  21. }
  22. last;
  23. }
  24. while (<FD>) {
  25. if (/^"Seek times for \/dev\/(.*)$/) {
  26. $ok = 0;
  27. foreach $key (keys %disks) {
  28. next unless $key eq $1;
  29. $ok = 1;
  30. }
  31. if ($ok != 1) {
  32. die "Disk results are screwed up, no $1.\n";
  33. }
  34. print "tmp/seek_$1.$file\n";
  35. open(OUT, ">tmp/seek_$1.$file");
  36. print OUT "%T Seek times for $disks{$1}\n";
  37. print OUT "%X Seek distance (MB)\n";
  38. print OUT "%Y Time in millisec\n";
  39. while (<FD>) {
  40. last unless /^\d/;
  41. print OUT;
  42. }
  43. close(OUT);
  44. }
  45. if (/^"Zone bandwidth for \/dev\/(.*)$/) {
  46. $ok = 0;
  47. foreach $key (keys %disks) {
  48. next unless $key eq $1;
  49. $ok = 1;
  50. }
  51. if ($ok != 1) {
  52. die "Disk results are screwed up, no $1.\n";
  53. }
  54. print "tmp/zone_$1.$file\n";
  55. open(OUT, ">tmp/zone_$1.$file");
  56. print OUT "%T Zone bandwidths for $disks{$1}\n";
  57. print OUT "%X Disk offset (MB)\n";
  58. print OUT "%Y Bandwidth (MB/sec)\n";
  59. while (<FD>) {
  60. last unless /^\d/;
  61. print OUT;
  62. }
  63. close(OUT);
  64. }
  65. }
  66. }
  67. exit 0;