1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
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, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNARL 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 2, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNARL 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. See the GNU General Public License --
|
17 |
|
|
-- for more details. You should have received a copy of the GNU General --
|
18 |
|
|
-- Public License distributed with GNARL; see file COPYING. If not, write --
|
19 |
|
|
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
|
20 |
|
|
-- Boston, MA 02110-1301, USA. --
|
21 |
|
|
-- --
|
22 |
|
|
-- As a special exception, if other files instantiate generics from this --
|
23 |
|
|
-- unit, or you link this unit with other files to produce an executable, --
|
24 |
|
|
-- this unit does not by itself cause the resulting executable to be --
|
25 |
|
|
-- covered by the GNU General Public License. This exception does not --
|
26 |
|
|
-- however invalidate any other reasons why the executable file might be --
|
27 |
|
|
-- covered by the GNU Public License. --
|
28 |
|
|
-- --
|
29 |
|
|
-- GNARL was developed by the GNARL team at Florida State University. --
|
30 |
|
|
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
31 |
|
|
-- --
|
32 |
|
|
------------------------------------------------------------------------------
|
33 |
|
|
|
34 |
|
|
-- This package provides exported subprograms to be called at debug time to
|
35 |
|
|
-- measure stack usage at run-time.
|
36 |
|
|
|
37 |
|
|
-- Note: this package must be a child package of System.Stack_Usage to have
|
38 |
|
|
-- visibility over its private part; it is however part of GNARL because it
|
39 |
|
|
-- needs to access tasking features via System.Tasking.Debug and
|
40 |
|
|
-- System.Task_Primitives.Operations;
|
41 |
|
|
|
42 |
|
|
package System.Stack_Usage.Tasking is
|
43 |
|
|
|
44 |
|
|
procedure Report_All_Tasks;
|
45 |
|
|
-- Print the current stack usage of all tasks on stderr. Exported to be
|
46 |
|
|
-- called also in debug mode.
|
47 |
|
|
|
48 |
|
|
pragma Export
|
49 |
|
|
(C,
|
50 |
|
|
Report_All_Tasks,
|
51 |
|
|
"__gnat_tasks_stack_usage_report_all_tasks");
|
52 |
|
|
|
53 |
|
|
procedure Report_Current_Task;
|
54 |
|
|
-- Print the stack usage of current task on stderr. Exported to be called
|
55 |
|
|
-- also in debug mode.
|
56 |
|
|
|
57 |
|
|
pragma Export
|
58 |
|
|
(C,
|
59 |
|
|
Report_Current_Task,
|
60 |
|
|
"__gnat_tasks_stack_usage_report_current_task");
|
61 |
|
|
|
62 |
|
|
subtype Stack_Usage_Result is System.Stack_Usage.Task_Result;
|
63 |
|
|
-- This type is a descriptor for task stack usage result
|
64 |
|
|
|
65 |
|
|
type Stack_Usage_Result_Array is
|
66 |
|
|
array (Positive range <>) of Stack_Usage_Result;
|
67 |
|
|
|
68 |
|
|
function Get_Current_Task_Usage return Stack_Usage_Result;
|
69 |
|
|
-- Return the current stack usage for the invoking task
|
70 |
|
|
|
71 |
|
|
function Get_All_Tasks_Usage return Stack_Usage_Result_Array;
|
72 |
|
|
-- Return an array containing the stack usage results for all tasks
|
73 |
|
|
|
74 |
|
|
procedure Print (Obj : Stack_Usage_Result);
|
75 |
|
|
-- Print Obj on stderr
|
76 |
|
|
|
77 |
|
|
end System.Stack_Usage.Tasking;
|