-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT 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 distributed with GNARL; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
(Value : System.Address) return Stack_Address
renames System.Storage_Elements.To_Integer;
+ Task_Name_Length : constant := 32;
+ -- The maximum length of task name displayed.
+ -- ??? Consider merging this variable with Max_Task_Image_Length.
+
+ type Task_Result is record
+ Task_Name : String (1 .. Task_Name_Length);
+
+ Value : Natural;
+ -- Amount of stack used. The value is calculated on the basis of the
+ -- mechanism used by GNAT to allocate it, and it is NOT a precise value.
+
+ Variation : Natural;
+ -- Possible variation in the amount of used stack. The real stack usage
+ -- may vary in the range Value +/- Variation
+
+ Max_Size : Natural;
+ end record;
+
+ type Result_Array_Type is array (Positive range <>) of Task_Result;
+
type Stack_Analyzer is private;
-- Type of the stack analyzer tool. It is used to fill a portion of the
-- stack with Pattern, and to compute the stack used after some execution.
-- appear as used in the final measure.
-- Strategy: As the user passes the value of the bottom of stack to
- -- the instrumentation to deal with the bottom offset error, and as as
+ -- the instrumentation to deal with the bottom offset error, and as
-- the instrumentation procedure knows where the pattern filling start
-- on the stack, the difference between the two values is the minimum
-- stack usage that the method can measure. If, when the results are
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 : Interfaces.Unsigned_32 := 16#DEAD_BEEF#);
private
- Task_Name_Length : constant := 32;
- -- The maximum length of task name displayed.
- -- ??? Consider merging this variable with Max_Task_Image_Length.
-
package Unsigned_32_Addr is
new System.Address_To_Access_Conversions (Interfaces.Unsigned_32);
Result_Id : Positive;
-- Id of the result. If less than value given to gnatbind -u corresponds
-- to the location in the result array of result for the current task.
-
- Stack_Used_When_Filling : Natural := 0;
- -- Amount of stack that was already used when actually filling the
- -- memory, and therefore not analyzed.
end record;
Environment_Task_Analyzer : Stack_Analyzer;
Compute_Environment_Task : Boolean;
- type Task_Result is record
- Task_Name : String (1 .. Task_Name_Length);
-
- Min_Measure : Natural;
- -- Minimum value for the measure
-
- Max_Measure : Natural;
- -- Maximum value for the measure, taking into account the actual size
- -- of the pattern filled.
-
- Max_Size : Natural;
- end record;
-
- type Result_Array_Type is array (Positive range <>) of Task_Result;
type Result_Array_Ptr is access all Result_Array_Type;
Result_Array : Result_Array_Ptr;