File: getdisk

package info (click to toggle)
lmbench 3.0-a9%2Bdebian.1-6
  • links: PTS
  • area: non-free
  • in suites: bookworm
  • size: 2,996 kB
  • sloc: ansic: 12,328; perl: 6,531; sh: 2,784; makefile: 731
file content (69 lines) | stat: -rwxr-xr-x 1,497 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

# Extract the disk graph data from lmbench result files.
# 
# Hacked into existence by Larry McVoy 
# Copyright (c) 1994 Larry McVoy.  GPLed software.
# $Id$
eval 'exec perl -Ssw $0 "$@"'
	if 0;

foreach $file (@ARGV) {
	open(FD, $file);
	$file =~ s|/|-|;
	while (<FD>) {
		next unless /DISK_DESC/;
		s/.DISK_DESC: //;
		chop; chop; chop;
		@_ = split(/[\[\]]/, $_);
		foreach $_ (@_) {
			next unless /:/;
			@foo = split(/:/, $_);
			$foo[0] =~ s|/dev/||;
			$disks{$foo[0]} = $foo[1];
		}
		last;
	}
	while (<FD>) {
		if (/^"Seek times for \/dev\/(.*)$/) {
			$ok = 0;
			foreach $key (keys %disks) {
				next unless $key eq $1;
				$ok = 1;
			}
			if ($ok != 1) {
				die "Disk results are screwed up, no $1.\n";
			}
			print "tmp/seek_$1.$file\n";
			open(OUT, ">tmp/seek_$1.$file");
			print OUT "%T Seek times for $disks{$1}\n";
			print OUT "%X Seek distance (MB)\n";
			print OUT "%Y Time in millisec\n";
			while (<FD>) {
				last unless /^\d/;
				print OUT;
			}
			close(OUT);
		}
		if (/^"Zone bandwidth for \/dev\/(.*)$/) {
			$ok = 0;
			foreach $key (keys %disks) {
				next unless $key eq $1;
				$ok = 1;
			}
			if ($ok != 1) {
				die "Disk results are screwed up, no $1.\n";
			}
			print  "tmp/zone_$1.$file\n";
			open(OUT, ">tmp/zone_$1.$file");
			print OUT "%T Zone bandwidths for $disks{$1}\n";
			print OUT "%X Disk offset (MB)\n";
			print OUT "%Y Bandwidth (MB/sec)\n";
			while (<FD>) {
				last unless /^\d/;
				print OUT;
			}
			close(OUT);
		}
	}
}
exit 0;