summaryrefslogtreecommitdiff
path: root/apps/JAWS/clients/WebSTONE/bin/wscollect.pl
blob: adf5fee56eb4739d4a6c34cc9124657613fe6f85 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/pkg/gnu/bin//perl
# $Header$
# updated version of the old wscollect script which goes through
# webstone run directories and summarizes the output in tabular
# format.
# syc 4/25/96
#

require "find.pl";

#
# the list @runs contains the timestamps for the runs which are found
# during the traversal of the runs directory. This list is used for
# indices into the associative arrays for storing run information.
# 
# $numclients{ $time }    - number of clients for the run
# $connrate{ $time }      - connection rate average
# $littlesload{ $time }   - little's load factor
# $latency{ $time }       - latency average
# $error{ $time }         - error rate
# $throughput{ $time }    - throughput

local( @runs,
       %numclients,
       %connrate,
       %littlesload,
       %latency,
       %error,
       %throughput);

# Got rid of the trick hack of the title names, someone can put it
# back in later
@title = ( "Timestamp",
	  "Total number of clients",
	  "Connection rate average (conn/s)",
	  "Little's Load Factor",
	  "Average Latency (seconds)",
	  "Error Level (%)",
	  "Throughput avg. for all connections (MBits/s)");


push( @ARGV, ".") if ( !@ARGV );

for (@ARGV) {
    &find( $_ );
}

&PrintOutput;

1;

sub wanted {
    local( $filename ) = $_;

    return unless ( $filename =~ /run/ );

    local( $instats) = 0;
    local( $runtime, $tag, $data, $cruft, @cruft );

    open( FILE, $filename ) || return; # bail if failed to open
    $runtime = `pwd`;
    @cruft = split(/\//,$runtime);
    $runtime = pop( @cruft);
    chop( $runtime);
    push( @runs, $runtime);
    while ( $line = <FILE>) {
	if (! $instats) {
	    $instats = 1 if ( $line =~ /^WEBSTONE 2\.0 results/ );
	    next;
	}
	chop( $line );
	( $tag, $data ) = split( /:?\s{2,}|\t/, $line);

	# perl hack to emulate case/switch statement
	$tag =~ /number of clients/ &&
	    ($numclients{ $runtime } = $data, next);
        $tag =~ /error rate/ &&
	    (( $error{ $runtime }) = $data =~ /([\d\.]+)/, next);
	$tag =~ /connection rate/ &&
	    (( $connrate{ $runtime }) = $data =~ /([\d\.]+)/, next);
	$tag =~ /Server thruput/ &&
	    (( $throughput{ $runtime }) = $data =~ /([\d\.]+)/, next);
	$tag =~ /Little's Load/  && 
            (( $littlesload{ $runtime}) = $data =~ /([\d\.]+)/, next); # '
        $tag =~ /Average response time/ &&
	    (( $latency{ $runtime } ) = $data =~ /([\d\.]+)/, next);
    }
    close( FILE );
    unless ( $throughput{ $runtime} )  {
	pop( @runs); # if we didn't get a throughput, then the
				# data is incomplete and just drop this run
    }
}


sub printdata {
    local ($timestamp, $num_clients, $conn_rate, 
	   $load, $latency, $error, $tput) = @_;
    format STDOUT =
@<<<<<<<<<<< @###### @######.## @####.## @###.#### @####.#### @######.##
$timestamp, $num_clients, $conn_rate, $load, $latency, $error, $tput
.

    if (!$printedTitles) {
	$printedTitles = 1;
	($ttimestamp, $tnum_clients, $tconn_rate, 
	       $tload, $tlatency, $terror, $ttput) = @title;
	format STDOUT_TOP =
^||||||||||| ^||||||| ^||||||||| ^||||||| ^||||||||| ^||||||||| ^|||||||||||
$ttimestamp, $tnum_clients, $tconn_rate, $tload, $tlatency, $terror, $ttput
^||||||||||| ^||||||| ^||||||||| ^||||||| ^||||||||| ^||||||||| ^|||||||||||
$ttimestamp, $tnum_clients, $tconn_rate, $tload, $tlatency, $terror, $ttput
^||||||||||| ^||||||| ^||||||||| ^||||||| ^||||||||| ^||||||||| ^|||||||||||
$ttimestamp, $tnum_clients, $tconn_rate, $tload, $tlatency, $terror, $ttput
^||||||||||| ^||||||| ^||||||||| ^||||||| ^||||||||| ^||||||||| ^|||||||||||
$ttimestamp, $tnum_clients, $tconn_rate, $tload, $tlatency, $terror, $ttput
^||||||||||| ^||||||| ^||||||||| ^||||||| ^||||||||| ^||||||||| ^|||||||||||
$ttimestamp, $tnum_clients, $tconn_rate, $tload, $tlatency, $terror, $ttput
---------------------------------------------------------------------------- 
.
    # write STDOUT_TOP;
    } # end if printedTitles
    write STDOUT;
}

sub PrintOutput {
    local( $runtime );

    for $runtime (sort @runs) {
	&printdata( $runtime, $numclients{ $runtime}, $connrate{ $runtime},
		  $littlesload{ $runtime}, $latency{ $runtime}, $error{ $runtime},
		  $throughput{ $runtime});
    }
}