gcc:
[official-gcc.git] / gcc / ada / s-traces-default.adb
blob2790c33e24ca773511c2a01750104f67803f25f9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . T R A C E S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2001-2005 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 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 with System.Soft_Links;
35 with System.Parameters;
36 with System.Traces.Format;
38 package body System.Traces is
40 package SSL renames System.Soft_Links;
41 use System.Traces.Format;
43 ----------------------
44 -- Send_Trace_Info --
45 ----------------------
47 procedure Send_Trace_Info (Id : Trace_T) is
48 Task_S : constant String := SSL.Task_Name.all;
49 Trace_S : String (1 .. 3 + Task_S'Length);
51 begin
52 if Parameters.Runtime_Traces then
53 Trace_S (1 .. 3) := "/N:";
54 Trace_S (4 .. Trace_S'Last) := Task_S;
55 Send_Trace (Id, Trace_S);
56 end if;
57 end Send_Trace_Info;
59 procedure Send_Trace_Info (Id : Trace_T; Timeout : Duration) is
60 Task_S : constant String := SSL.Task_Name.all;
61 Timeout_S : constant String := Duration'Image (Timeout);
62 Trace_S : String (1 .. 6 + Task_S'Length + Timeout_S'Length);
64 begin
65 if Parameters.Runtime_Traces then
66 Trace_S (1 .. 3) := "/N:";
67 Trace_S (4 .. 3 + Task_S'Length) := Task_S;
68 Trace_S (4 + Task_S'Length .. 6 + Task_S'Length) := "/T:";
69 Trace_S (7 + Task_S'Length .. Trace_S'Last) := Timeout_S;
70 Send_Trace (Id, Trace_S);
71 end if;
72 end Send_Trace_Info;
73 end System.Traces;