-- $Id: test_all.adb,v 1.2 2003/11/18 02:36:14 baker Exp baker $ -- Run experiments to test all types of deadline-derive -- aperiodic servers. -- ??? consider combining common elements of this and test_rms.adb -- into a shared package with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Numerics.Elementary_Functions; with Ada.Command_Line; with System_Type; use System_Type; with Random_Tools; use Random_Tools; with BGS; use BGS; with PLS; use PLS; with DDS; use DDS; with DSS; use DSS; with DXS; use DXS; with Sizes; use Sizes; procedure Test_ALL is use Int_IO; -- The prefix to be used for constructing output files -- for this set of experiments. Prefix : constant String := "edf"; procedure Set_Up (List: Process_List) is -- set up to run one experiment begin -- initialize the pseudo-random number generator Start (Sizes.Default_I, Sizes.Default_J, Sizes.Default_K, Sizes.Default_L, false); Calculate_Major_Period (List); -- decide how long to run the simulation End_Of_Test := Major_Period * Repeat; end Set_Up; function Plot_File_Name (Run: Runs; IAT: IATS) return String is -- Generate the name of the plot file, -- encoding the periodic load level (Run) and -- average aperiodic inter-arrival time (IAT). begin return Prefix & character'val (character'pos ('A')+Run-1) & character'val (character'pos ('A')+IAT-1); end Plot_File_Name; procedure Put_Plot (F: Float) is -- output a data point to the plot file begin if F<=0.0 then put (Plot, "99999.999"); else put (Plot, F, 4, 3, 0); end if; put (Plot, " "); end Put_Plot; procedure Put_Tex (S: Sizes.Servers; R: Runs; L: Loads) is -- output a data point to the LaTex table file F: constant Float := Avg (S)(R)(L); use Ada.Numerics.Elementary_Functions; begin if F>0.0 then put (Tex, " & "); put (Tex, Integer (F), 5); put (Tex, " & $\PM$ "); put (Tex, Integer (Z99*SD (S)(R)(L)/Sqrt (float (Comptd (S)(R)(L)))), 3); else put (Tex, " & \overload & \overload "); end if; end Put_Tex; procedure Chk (I: IATS; R: Runs; L: Loads; M: Float) is -- check for average response times that are better than -- predicted by queueing theory for an M/M/1 system, -- which would indicate an error in our simulation, -- the server scheduling algorithm, or the sizing of the server begin for S in Sizes.Servers loop if Avg (S)(R)(L) open (Errs, out_file, Prefix & ".errors"); end; -- get repetition count, if any, from command line declare Last: Integer; use Ada.Command_Line; begin if Argument_Count > 1 then get (Argument (1), Repeat, Last); end if; exception when others=> Put_Line ("bad repetition count"); raise; end; -- repeat the set of experiments for each of a set of values for the -- processor utlization level of the periodic task set that competes -- with the aperiodic server for I in Sizes.IATS loop -- create the output file begin create (Tex, out_file, Prefix & character'val (character'pos ('A')+I-1)&".tex"); exception when others=> open (Tex, out_file, Prefix & character'val (character'pos ('A')+I-1)&".tex"); end; -- put out the header put_line (Tex, "\begin{table}\begin{center}"); put_line (Tex, "\begin{tabular}{ccr@{}rr@{}rr@{}rr@{}rr@{}r}"); put_line (Tex, "periodic&aperiodic&"); put_line (Tex, "\twocol{BGS}&\twocol{PLS}&\twocol{DDS}&"); put_line (Tex, "\twocol{DSS}&\twocol{DXS}\\[10pt]\hline"); -- repeat the experiments for each of a set of values for the -- average processor utilization of the aperiodic server for R in Sizes.Runs loop put_line (Tex, "\\ "); -- repeat the experiments for for J in Sizes.Loads loop -- initialize structures that define the experiment Set_Up (Processes (R)); -- run the experiment Background_Server (Interarrival_Time_Data (I), Aperiodic_Load (R)(J), Processes (R), Avg (Sizes.BGS)(R)(J), SD (Sizes.BGS)(R)(J), Max (Sizes.BGS)(R)(J), Reqstd (Sizes.BGS)(R)(J), Comptd (Sizes.BGS)(R)(J), Missed (Sizes.BGS)(R)(J), Util (Sizes.BGS)(R)(J)); Set_Up (Processes (R)); Polling_Server (Interarrival_Time_Data (I), Aperiodic_Load (R)(J), Processes (R), EDF_Size (R)(Sizes.PLS), Avg (Sizes.PLS)(R)(J), SD (Sizes.PLS)(R)(J), Max (Sizes.PLS)(R)(J), Reqstd (Sizes.PLS)(R)(J), Comptd (Sizes.PLS)(R)(J), Missed (Sizes.PLS)(R)(J), Util (Sizes.PLS)(R)(J)); Set_Up (Processes (R)); DD_Server (Interarrival_Time_Data (I), Aperiodic_Load (R)(J), Processes (R), EDF_Size (R)(Sizes.DDS), Avg (Sizes.DDS)(R)(J), SD (Sizes.DDS)(R)(J), Max (Sizes.DDS)(R)(J), Reqstd (Sizes.DDS)(R)(J), Comptd (Sizes.DDS)(R)(J), Missed (Sizes.DDS)(R)(J), Util (Sizes.DDS)(R)(J)); Set_Up (Processes (R)); DS_Server (Interarrival_Time_Data (I), Aperiodic_Load (R)(J), Processes (R), EDF_Size (R)(Sizes.DSS), Avg (Sizes.DSS)(R)(J), SD (Sizes.DSS)(R)(J), Max (Sizes.DSS)(R)(J), Reqstd (Sizes.DSS)(R)(J), Comptd (Sizes.DSS)(R)(J), Missed (Sizes.DSS)(R)(J), Util (Sizes.DSS)(R)(J)); Set_Up (Processes (R)); DX_Server (Interarrival_Time_Data (I), Aperiodic_Load (R)(J), Processes (R), EDF_Size (R)(Sizes.DXS), Avg (Sizes.DXS)(R)(J), SD (Sizes.DXS)(R)(J), Max (Sizes.DXS)(R)(J), Reqstd (Sizes.DXS)(R)(J), Comptd (Sizes.DXS)(R)(J), Missed (Sizes.DXS)(R)(J), Util (Sizes.DXS)(R)(J)); end loop; -- print out LaTeX table of results for this -- combination of periodic and aperiodic loads for J in Loads loop -- for each aperiodic load level begin -- periodic task utilization level for this run put (Tex, float (U (R))/100.0, 1, 2, 0); put (Tex, " & "); -- average aperiodic server utlization level for this run put (Tex, Util (Sizes.BGS)(R)(J), 1, 2, 0); for S in Sizes.Servers loop -- for each server size -- put out the results of the experiment Put_Tex (S, R, J); end loop; put (Tex, "\\"); new_line (Tex); exception when others=> put_line (Tex, "exception in output"); end; end loop; put_line (Tex, "\\"); end loop; put (Tex, "\end{tabular}\end{center}"); put (Tex, "\caption{EDF response times, mean aperiodic IAT "); put (Tex, integer (float (End_Of_Test)/float (Reqstd (Sizes.DXS)(I)(1))), 1); put (Tex, ", after "); put (Tex, End_Of_Test, 1); put_line (Tex, " time units.}"); put (Tex, "\label{tab:"); put (Tex, character'val (character'pos ('A')+I-1)); put_line (Tex, "}\end{table}"); close (Tex); for R in Runs loop begin create (Plot, out_file, Plot_File_Name (R, I)); exception when others=> open (Plot, out_file, Plot_File_Name (R, I)); end; for J in Loads loop declare T: constant Float := Avg (Sizes.BGS)(R)(J); IAT: constant Float := Interarrival_Time_Data (I); AL: constant Float := Util (Sizes.BGS)(R)(J); M: constant Float := -- M/M/1, for full server AL*IAT/ (1.0-AL); -- M/M/1, relative to server capacity = -- S: constant Float := float (EDF_Size (R)(Sizes.PLS)); -- M: constant Float := S*AL*IAT/ (S-AL*float (Server_Period)); begin Chk (I, R, J, M); put_Plot (AL); -- 1 put_Plot (T); -- 2 put_Plot (Avg (Sizes.PLS)(R)(J)); -- 3 put_Plot (Avg (Sizes.DDS)(R)(J)); -- 4 put_Plot (Avg (Sizes.DSS)(R)(J)); -- 5 put_Plot (Avg (Sizes.DXS)(R)(J)); -- 6 put_Plot (M); -- 7 put_Plot (Avg (Sizes.PLS)(R)(J)/T); -- 8 put_Plot (Avg (Sizes.DDS)(R)(J)/T); -- 9 put_Plot (Avg (Sizes.DSS)(R)(J)/T); -- 10 put_Plot (Avg (Sizes.DXS)(R)(J)/T); -- 11 put_Plot (M/T); -- 12 end; new_line (Plot); end loop; close (Plot); end loop; end loop; end Test_ALL;