1------------------------------------------------------------------------------
2--                                                                          --
3--                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4--                                                                          --
5--            S Y S T E M . S T A C K _ U S A G E . T A S K I N G           --
6--                                                                          --
7--                                  S p e c                                 --
8--                                                                          --
9--           Copyright (C) 2009-2019, Free Software Foundation, Inc.        --
10--                                                                          --
11-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12-- terms of the  GNU General Public License as published  by the Free Soft- --
13-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17--                                                                          --
18-- As a special exception under Section 7 of GPL version 3, you are granted --
19-- additional permissions described in the GCC Runtime Library Exception,   --
20-- version 3.1, as published by the Free Software Foundation.               --
21--                                                                          --
22-- You should have received a copy of the GNU General Public License and    --
23-- a copy of the GCC Runtime Library Exception along with this program;     --
24-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25-- <http://www.gnu.org/licenses/>.                                          --
26--                                                                          --
27-- GNARL was developed by the GNARL team at Florida State University.       --
28-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
29--                                                                          --
30------------------------------------------------------------------------------
31
32--  This package provides exported subprograms to be called at debug time to
33--  measure stack usage at run-time.
34
35--  Note: this package must be a child package of System.Stack_Usage to have
36--  visibility over its private part; it is however part of GNARL because it
37--  needs to access tasking features via System.Tasking.Debug and
38--  System.Task_Primitives.Operations;
39
40package System.Stack_Usage.Tasking is
41
42   procedure Report_All_Tasks;
43   --  Print the current stack usage of all tasks on stderr. Exported to be
44   --  called also in debug mode.
45
46   pragma Export
47     (C,
48      Report_All_Tasks,
49      "__gnat_tasks_stack_usage_report_all_tasks");
50
51   procedure Report_Current_Task;
52   --  Print the stack usage of current task on stderr. Exported to be called
53   --  also in debug mode.
54
55   pragma Export
56     (C,
57      Report_Current_Task,
58      "__gnat_tasks_stack_usage_report_current_task");
59
60   subtype Stack_Usage_Result is System.Stack_Usage.Task_Result;
61   --  This type is a descriptor for task stack usage result
62
63   type Stack_Usage_Result_Array is
64     array (Positive range <>) of Stack_Usage_Result;
65
66   function Get_Current_Task_Usage return Stack_Usage_Result;
67   --  Return the current stack usage for the invoking task
68
69   function Get_All_Tasks_Usage return Stack_Usage_Result_Array;
70   --  Return an array containing the stack usage results for all tasks
71
72   procedure Print (Obj : Stack_Usage_Result);
73   --  Print Obj on stderr
74
75end System.Stack_Usage.Tasking;
76