#!/usr/local/bin/perl5 -w use English; sub read_data { my($fname) = @_; my($lref); my($tref); my(@words); $lref = []; open(INPUT,$fname) || die "Can't open file $fname."; while () { chop; s/,//g; s/\%//g; @words = split; if (@words < 4 ) { next; } if ($words[1] eq "ReqRate:") { $tref = [$words[2],$words[5],$words[8],$words[11],$words[14]]; push(@$lref,$tref); } } close(INPUT); return($lref); } sub print_data { my($lref,$fname,$index) = @_; open(OUTPUT,">$fname"); foreach $dset (@$lref) { printf OUTPUT "$$dset[0] $$dset[$index] \n"; } close(OUTPUT); } $case_1 = &read_data("sim3.rawsol_1"); $case_2 = &read_data("sim3.rawsol_2"); $case_3 = &read_data("sim3.rawsol_3"); $tit1 = "RR=TRUE_OG=TRUE"; $tit2 = "RR=FALSE_OG=TRUE"; $tit3 = "RR=TRUE_OG=FALSE"; &print_data($case_1,$tit1,1); &print_data($case_2,$tit2,1); &print_data($case_3,$tit3,1); # print bus util open(GNUPLOT, ">tmp.cmd "); printf GNUPLOT "set xlabel \"Request Rate\"\n"; printf GNUPLOT "set ylabel \"Percent Bus Utilization\"\n"; printf GNUPLOT "set title \"Request Rate vs Bus Utilization\"\n"; printf GNUPLOT "set data style lines\n"; printf GNUPLOT "set output \"busutil.ps\"\n"; printf GNUPLOT "set terminal postscript\n"; printf GNUPLOT "plot \"$tit1\", \"$tit2\", \"$tit3\"\n"; printf GNUPLOT "quit"; close(GNUPLOT); `gnuplot tmp.cmd`; # print average requests &print_data($case_1,$tit1,2); &print_data($case_2,$tit2,2); &print_data($case_3,$tit3,2); open(GNUPLOT, ">tmp.cmd "); printf GNUPLOT "set xlabel \"Request Rate\"\n"; printf GNUPLOT "set ylabel \"Average Requests\"\n"; printf GNUPLOT "set title \"Request Rate vs Average Requests\"\n"; printf GNUPLOT "set data style lines\n"; printf GNUPLOT "set output \"avgreq.ps\"\n"; printf GNUPLOT "set terminal postscript\n"; printf GNUPLOT "plot \"$tit1\", \"$tit2\", \"$tit3\"\n"; printf GNUPLOT "quit"; close(GNUPLOT); `gnuplot tmp.cmd`; # print average requests &print_data($case_1,$tit1,4); &print_data($case_2,$tit2,4); &print_data($case_3,$tit3,4); open(GNUPLOT, ">tmp.cmd "); printf GNUPLOT "set xlabel \"Request Rate\"\n"; printf GNUPLOT "set ylabel \"Idle Time\"\n"; printf GNUPLOT "set title \"Request Rate vs Idle Time\"\n"; printf GNUPLOT "set data style lines\n"; printf GNUPLOT "set output \"idle.ps\"\n"; printf GNUPLOT "set terminal postscript\n"; printf GNUPLOT "plot \"$tit1\", \"$tit2\", \"$tit3\"\n"; printf GNUPLOT "quit"; close(GNUPLOT); `gnuplot tmp.cmd`;