Download Experiment Transcripts for the Evaluation of the Rational Environment

Transcript
A.2. Procedure Record_Size’Body
with Directory_Tools, Io;
procedure Record_Size (Message : String := "";
Objects : String := "";
Recursive : Boolean := True) is
package Dt renames Directory_Tools;
package Stat renames Directory_Tools.Statistics;
Orig_Obj, Obj : Dt.Object.Handle;
Iter : Dt.Object.Iterator;
Sum_Object_Size, Sum_Total_Size : Long_Integer := 0;
Answer2 : String (1 .. 10);
begin
if Recursive then
Iter := Dt.Naming.Resolution (Objects & "??");
else
Iter := Dt.Naming.Resolution (Objects);
end if;
Orig_Obj := Dt.Object.Value (Iter);
while not Dt.Object.Done (Iter) loop
Obj := Dt.Object.Value (Iter);
Sum_Object_Size := Sum_Total_Size + Stat.Object_Size (Obj) / 8;
Sum_Total_Size := Sum_Total_Size + Stat.Total_Size (Obj) / 8;
Dt.Object.Next (Iter);
end loop;
if Recursive then
Answer2 := "everything";
else
Answer2 := "itself
";
end if;
declare
Answer1 : constant String := Dt.Naming.Simple_Name (Orig_Obj) & " ";
Answer3 : constant String :=
" object_size => " & Long_Integer’Image (Sum_Object_Size) &
", total_size => " & Long_Integer’Image (Sum_Total_Size);
begin
Io.Put_Line (Message);
Io.Put_Line (Answer1 & Answer2 & Answer3);
end;
end Record_Size;
A.3. Using Record_Size
Record_Size’Spec and Record_Size’Body can be placed in the experimenter’s home directory
and compiled and executed from the home directory. To execute the procedure:
Open a command window
<Create Command>
Enter
Record_Size
<Complt>
Record_Size(Message => "",
Objects => "";
Recursive => True);
Supply a message, if desired, to annotate the log and provide the full pathname to the object and
the object named for the value of Objects. If a measurement of only the object and not its
sub-objects is desired, change the value of Recursive to False.
162
CMU/SEI-88-TR-21