File: getresults

package info (click to toggle)
lmbench 3.0-a9%2Bdebian.1-3
  • links: PTS
  • area: non-free
  • in suites: bullseye
  • size: 2,752 kB
  • sloc: ansic: 12,328; perl: 6,531; sh: 3,965; makefile: 730
file content (99 lines) | stat: -rwxr-xr-x 1,926 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/perl -ws

# Search through the archives splitting out stuff that has pathnames.

while (1) {
	&headers;
	&body;
}

sub headers
{
	while (<>) {
		warn "HDR $_" if ($debug);
		return if /^\s*$/;
	}
	exit;
}

# Save the info for the system, skipping everything ig there is no info.
sub body
{
	@info = ();
	while (<>) {
		last if m|^[-]+ \.\./results|;
		last if /^\[lmbench/;
		if (/^From[: ]/) { warn "FROM $_"; return; }
		warn "INFO $_" if ($debug);
		push(@info, $_);
	}
	if (/^[-]+ \.\.\/results/) {
		@foo = split;
		$path = $foo[1];
		$path =~ s|\.\./||;
		warn "PATH $path\n" if ($debug);
		&results;
		return;
	} 
	warn "SKIPPING one\n";
	while (<>) {
		warn "SKIP $_" if ($SKIP);
		last if /^Memory load latency/;
		if (/^From[: ]/) { warn "FROM $_"; return; }
	}
	die "No memory load latency" unless /^Memory load latency/;
	while (<>) {
		warn "SKIP $_" if ($SKIP);
		last if /^\[/;
		if (/^From[: ]/) { warn "FROM $_"; return; }
	}
	die "No date" unless /^\[/;
	while (<>) {
		last unless /^\s*$/;
		if (/^From[: ]/) { warn "FROM $_"; return; }
	}
}

sub results
{
	@results = ();
	while (<>) {
		goto done if (/^From[: ]/);
		warn "RES $_" if ($RES);
		push(@results, $_);
		last if /^Memory load latency/;
	}
	die "No memory load latency" unless /^Memory load latency/;
	while (<>) {
		goto done if (/^From[: ]/);
		warn "RES $_" if ($RES);
		push(@results, $_);
		last if /^\[/;
	}
	die "No date" unless /^\[/;
	while (<>) {
		last unless /^\s*$/;
	}

done:
	($dir = $path) =~ s|/[^/]+$||;
	warn "DIR $dir\n" if ($debug);
	system "mkdir -p $dir";
	if (-e $path) {
		warn "CONFLICT on $path\n" if $debug;
		for ($i = 0; ; $i++) {
			$tmp = "${path}.${i}";
			last if ! -e $tmp;
			warn "CONFLICT on $tmp\n" if $debug;
		}
		$path = $tmp;
	}
	$info = $path . ".INFO";
	open(O, ">$info");
	print O @info;
	close(O);
	warn "Saving $path\n" if $verbose;
	open(O, ">$path");
	print O @results;
	close(O);
}