/usr/bin/siege2csv is in siege 4.0.4-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | #!/usr/bin/perl
#siege2csv.pl is a perl script that parses the output from bombardmnet.sh
#into comma seperated values for easy use with spreadsheets.
#Copyright (C) 2001 Peter J. Hutnick
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
#For information, write the author, Peter Hutnick at phutnick@aperian.com.
open (INPUT, "< $ARGV[0]")
or die "Can't open data file or no data file specified.\n";
{
local $/ = undef;
@list = split('\n', <INPUT>); # each line becomes an string in array list
}
close(INPUT);
$numchunks = scalar(@list); # Find out how many strings, so we can drive
# loops
# This ugly thing is where all the work gets done. It maintains data
# associtivity by relying on the coinidence that all the data "just ends
# up" in order. I may try to clean this up at a future date.
$usersub=0;
$transub=0;
$elapsub=0;
$datasub=0;
$respsub=0;
$tratesub=0;
$tputsub=0;
$consub=0;
$codesub=0;
for ($i=0; $numchunks > $i; $i++)
{
# print $list[$i];
# print "\n";
if ($list[$i] =~ /.. Preparing \d* concurrent users.*/ )
{
# print $list[$i]; print "\n";
$numusers[$usersub] = $list[$i];
$usersub++;
}
elsif ($list[$i] =~ /Transactions.*/)
{
$transactions[$transub] = $list[$i];
$transub++;
}
elsif ($list[$i] =~ /Elapsed.*/)
{
$elapsed[$elapsub] = $list[$i];
$elapsub++;
}
elsif ($list[$i] =~ /Data transferred.*/)
{
$data[$datasub] = $list[$i];
$datasub++;
}
elsif ($list[$i] =~ /Response.*/)
{
$response[$respsub] = $list[$i];
$respsub++;
}
elsif ($list[$i] =~ /Transaction rate.*/)
{
$trate[$tratesub] = $list[$i];
$tratesub++;
}
elsif ($list[$i] =~ /Throughput.*/)
{
$tput[$tputsub] = $list[$i];
$tputsub++;
}
elsif ($list[$i] =~ /Concurrency.*/)
{
$concurr[$consub] = $list[$i];
$consub++;
}
elsif ($list[$i] =~ /Successful transactions.*/)
{
$code200[$codesub] = $list[$i];
$codesub++;
}
}
for ($i=0; $usersub > $i; $i++)
{
# print "Number of Users\n";
$numusers[$i] =~ tr/a-zA-Z//d;
$numusers[$i] =~ tr/://d;
$numusers[$i] =~ tr/\.//d;
$numusers[$i] =~ tr/\*//d;
$numusers[$i] =~ tr/\t//d;
$numusers[$i] =~ tr/ //s;
# print $numusers[$i];
}
# These for loops _try_ to prune the strings down to the numeric
# values. The last one (code 200) does not work well because of the
# numeric elemnet of the description.
# Also, I can't get rid of that last leading space. Doesn't seem to
# bother Excel 2000, but for neatness this should be addressed.
# I don't know how to do perl functions. Clearly a function would be
# better here.
for ($i=0; $transub > $i; $i++)
{
# print "Number of Hits\n";
$transactions[$i] =~ tr/a-zA-Z//d;
$transactions[$i] =~ tr/://d;
$transactions[$i] =~ tr/\t//d;
$transactions[$i] =~ tr/ //s;
# print $transactions[$i];
}
for ($i=0; $elapsub > $i; $i++)
{
# print "Elapsed Time\n";
$elapsed[$i] =~ tr/a-zA-Z//d;
$elapsed[$i] =~ tr/://d;
$elapsed[$i] =~ tr/\t//d;
$elapsed[$i] =~ tr/ //s;
# print $elapsed[$i];
}
for ($i=0; $datasub > $i; $i++)
{
# print "Data Transferred\n";
$data[$i] =~ tr/a-zA-Z//d;
$data[$i] =~ tr/://d;
$data[$i] =~ tr/\t//d;
$data[$i] =~ tr/ //s;
# print $data[$i];
}
for ($i=0; $respsub > $i; $i++)
{
# print "Response Time\n";
$response[$i] =~ tr/a-zA-Z//d;
$response[$i] =~ tr/://d;
$response[$i] =~ tr/\t//d;
$response[$i] =~ tr/ //s;
# print $response[$i];
}
for ($i=0; $tratesub > $i; $i++)
{
# print "Transaction Rate\n";
$trate[$i] =~ tr/a-zA-Z//d;
$trate[$i] =~ tr/://d;
$trate[$i] =~ tr/\///d;
$trate[$i] =~ tr/\t//d;
$trate[$i] =~ tr/ //s;
# print $trate[$i];
}
for ($i=0; $tputsub > $i; $i++)
{
# print "Throughput\n";
$tput[$i] =~ tr/a-zA-Z//d;
$tput[$i] =~ tr/://d;
$tput[$i] =~ tr/\///d;
$tput[$i] =~ tr/\t//d;
$tput[$i] =~ tr/ //s;
# print $tput[$i];
}
for ($i=0; $consub > $i; $i++)
{
# print "Concurrency\n";
$concurr[$i] =~ tr/a-zA-Z//d;
$concurr[$i] =~ tr/://d;
$concurr[$i] =~ tr/\t//d;
$concurr[$i] =~ tr/ //s;
# print $concurr[$i];
}
for ($i=0; $codesub > $i; $i++)
{
# print "Code 200\n";
$code200[$i] =~ tr/a-zA-Z//d;
$code200[$i] =~ tr/200/ /d;
$code200[$i] =~ tr/\t//d;
$code200[$i] =~ tr/://d;
$code200[$i] =~ tr/ //s;
# print $code200[$i];
}
# Okay, data is as good as it is going to get. Let's start writing the
# output CSV file.
open (OUTFILE, "> $ARGV[0].csv")
or die "Cannot write to designated output file: $!\n";
# The next line sets up the colum titles.
# The leading comma in ",Transactions" causes the number of users colum to
# be titleless. I suppose it could be Users in front instead . . .
print OUTFILE ",Transactions,Elapsed Time,Data Transferred,Response Time,Transaction Rate,Throughput,Concurrency,Code 200 (note that this is horribly broken.) \n";
# Here we fill the data in the colums.
for ($i=0; $transub > $i; $i++)
{
print OUTFILE $numusers[$i], ",", $transactions[$i], ",",
$elapsed[$i], ",", $data[$i], ",", $response[$i], ",", $trate[$i], ",", $tput[$i], ",", $concurr[$i], ",", $code200[$i];
print OUTFILE "\n";
}
close (OUTFILE);
|