diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-29 12:05:44 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-29 12:05:44 +0200 |
commit | 91c2cbdb6847c9c1bbf1c0ce9d7e2f9bd7e3e5ab (patch) | |
tree | e0500df5e9169f2d414cedff64d374e236571d13 /gcc/ada/s-stausa.adb | |
parent | 6d47b1e3e982e90a53c20a3f6a7a7ed3cd78132d (diff) | |
download | gcc-91c2cbdb6847c9c1bbf1c0ce9d7e2f9bd7e3e5ab.zip gcc-91c2cbdb6847c9c1bbf1c0ce9d7e2f9bd7e3e5ab.tar.gz gcc-91c2cbdb6847c9c1bbf1c0ce9d7e2f9bd7e3e5ab.tar.bz2 |
[multiple changes]
2009-04-29 Arnaud Charlet <charlet@adacore.com>
* s-taskin.adb (Initialize): Remove pragma Warnings Off and remove
unused assignment.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* make.adb: Minor reformatting.
Minor code reorganization throughout.
2009-04-29 Matteo Bordin <bordin@adacore.com>
* s-stausa.ads: Changed visibility of type Task_Result: moved to
public part to give application visibility over it.
This is for future improvement and to build a public API on top of it.
Changed record components name of type Task_Result to reflect the new
way of reporting.
* s-stausa.adb: Actual_Size_Str changed to reflect the new way of
reporting Stack usage.
* gnat_ugn.texi: Update doc of stack usage report.
* g-tastus.ads, s-stusta.ads, s-stusta.adb: New files.
* Makefile.rtl: Add new run-time files.
From-SVN: r146942
Diffstat (limited to 'gcc/ada/s-stausa.adb')
-rw-r--r-- | gcc/ada/s-stausa.adb | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/gcc/ada/s-stausa.adb b/gcc/ada/s-stausa.adb index 859a9de..bf14beb 100644 --- a/gcc/ada/s-stausa.adb +++ b/gcc/ada/s-stausa.adb @@ -173,7 +173,7 @@ package body System.Stack_Usage is Index_Str : constant String := "Index"; Task_Name_Str : constant String := "Task Name"; Stack_Size_Str : constant String := "Stack Size"; - Actual_Size_Str : constant String := "Stack usage [min - max]"; + Actual_Size_Str : constant String := "Stack usage [Value +/- Variation]"; function Get_Usage_Range (Result : Task_Result) return String; -- Return string representing the range of possible result of stack usage @@ -204,8 +204,8 @@ package body System.Stack_Usage is Result_Array.all := (others => (Task_Name => (others => ASCII.NUL), - Min_Measure => 0, - Max_Measure => 0, + Variation => 0, + Value => 0, Max_Size => 0)); -- Set the Is_Enabled flag to true, so that the task wrapper knows that @@ -222,16 +222,16 @@ package body System.Stack_Usage is if Stack_Size_Chars /= Null_Address then declare - Stack_Size : Integer; + My_Stack_Size : Integer; begin - Stack_Size := System.CRTL.atoi (Stack_Size_Chars) * 1024; + My_Stack_Size := System.CRTL.atoi (Stack_Size_Chars) * 1024; Initialize_Analyzer (Environment_Task_Analyzer, "ENVIRONMENT TASK", - Stack_Size, - Stack_Size, + My_Stack_Size, + My_Stack_Size, System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address)); Fill_Stack (Environment_Task_Analyzer); @@ -318,7 +318,7 @@ package body System.Stack_Usage is procedure Initialize_Analyzer (Analyzer : in out Stack_Analyzer; Task_Name : String; - Stack_Size : Natural; + My_Stack_Size : Natural; Max_Pattern_Size : Natural; Bottom : Stack_Address; Pattern : Unsigned_32 := 16#DEAD_BEEF#) @@ -327,7 +327,7 @@ package body System.Stack_Usage is -- Initialize the analyzer fields Analyzer.Bottom_Of_Stack := Bottom; - Analyzer.Stack_Size := Stack_Size; + Analyzer.Stack_Size := My_Stack_Size; Analyzer.Pattern_Size := Max_Pattern_Size; Analyzer.Pattern := Pattern; Analyzer.Result_Id := Next_Id; @@ -414,11 +414,11 @@ package body System.Stack_Usage is --------------------- function Get_Usage_Range (Result : Task_Result) return String is - Min_Used_Str : constant String := Natural'Image (Result.Min_Measure); - Max_Used_Str : constant String := Natural'Image (Result.Max_Measure); + Variation_Used_Str : constant String := + Natural'Image (Result.Variation); + Value_Used_Str : constant String := Natural'Image (Result.Value); begin - return "[" & Min_Used_Str (2 .. Min_Used_Str'Last) & " -" - & Max_Used_Str & "]"; + return "[" & Value_Used_Str & " +/- " & Variation_Used_Str & "]"; end Get_Usage_Range; --------------------- @@ -431,16 +431,16 @@ package body System.Stack_Usage is Max_Stack_Size_Len : Natural; Max_Actual_Use_Len : Natural) is - Result_Id_Str : constant String := Natural'Image (Result_Id); - Stack_Size_Str : constant String := Natural'Image (Result.Max_Size); - Actual_Use_Str : constant String := Get_Usage_Range (Result); + Result_Id_Str : constant String := Natural'Image (Result_Id); + My_Stack_Size_Str : constant String := Natural'Image (Result.Max_Size); + Actual_Use_Str : constant String := Get_Usage_Range (Result); Result_Id_Blanks : constant String (1 .. Index_Str'Length - Result_Id_Str'Length) := (others => ' '); Stack_Size_Blanks : constant - String (1 .. Max_Stack_Size_Len - Stack_Size_Str'Length) := + String (1 .. Max_Stack_Size_Len - My_Stack_Size_Str'Length) := (others => ' '); Actual_Use_Blanks : constant @@ -453,7 +453,7 @@ package body System.Stack_Usage is Put (" | "); Put (Result.Task_Name); Put (" | "); - Put (Stack_Size_Blanks & Stack_Size_Str); + Put (Stack_Size_Blanks & My_Stack_Size_Str); Put (" | "); Put (Actual_Use_Blanks & Actual_Use_Str); New_Line; @@ -488,8 +488,8 @@ package body System.Stack_Usage is for J in Result_Array'Range loop exit when J >= Next_Id; - if Result_Array (J).Max_Measure - > Result_Array (Max_Actual_Use_Result_Id).Max_Measure + if Result_Array (J).Value + > Result_Array (Max_Actual_Use_Result_Id).Value then Max_Actual_Use_Result_Id := J; end if; @@ -559,12 +559,13 @@ package body System.Stack_Usage is Result : Task_Result := (Task_Name => Analyzer.Task_Name, Max_Size => Analyzer.Stack_Size, - Min_Measure => 0, - Max_Measure => 0); + Variation => 0, + Value => 0); Overflow_Guard : constant Integer := Analyzer.Stack_Size - Stack_Size (Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Of_Stack); + Max, Min : Positive; begin if Analyzer.Pattern_Size = 0 then @@ -572,15 +573,17 @@ package body System.Stack_Usage is -- at all. In other words, we used at least everything (and possibly -- more). - Result.Min_Measure := Analyzer.Stack_Size - Overflow_Guard; - Result.Max_Measure := Analyzer.Stack_Size; + Min := Analyzer.Stack_Size - Overflow_Guard; + Max := Analyzer.Stack_Size; else - Result.Min_Measure := Stack_Size - (Analyzer.Topmost_Touched_Mark, - Analyzer.Bottom_Of_Stack); - Result.Max_Measure := Result.Min_Measure + Overflow_Guard; + Min := Stack_Size + (Analyzer.Topmost_Touched_Mark, Analyzer.Bottom_Of_Stack); + Max := Min + Overflow_Guard; end if; + Result.Value := (Max + Min) / 2; + Result.Variation := (Max - Min) / 2; + if Analyzer.Result_Id in Result_Array'Range then -- If the result can be stored, then store it in Result_Array |