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-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 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-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
32with System.Soft_Links;
33with System.Parameters;
34with System.Traces.Format;
35
36package body System.Traces is
37
38   package SSL renames System.Soft_Links;
39   use System.Traces.Format;
40
41   ----------------------
42   -- Send_Trace_Info  --
43   ----------------------
44
45   procedure Send_Trace_Info (Id : Trace_T) is
46      Task_S  : constant String := SSL.Task_Name.all;
47      Trace_S : String (1 .. 3 + Task_S'Length);
48
49   begin
50      if Parameters.Runtime_Traces then
51         Trace_S (1 .. 3) := "/N:";
52         Trace_S (4 .. Trace_S'Last) := Task_S;
53         Send_Trace (Id, Trace_S);
54      end if;
55   end Send_Trace_Info;
56
57   procedure Send_Trace_Info (Id : Trace_T; Timeout : Duration) is
58      Task_S    : constant String := SSL.Task_Name.all;
59      Timeout_S : constant String := Duration'Image (Timeout);
60      Trace_S   : String (1 .. 6 + Task_S'Length + Timeout_S'Length);
61
62   begin
63      if Parameters.Runtime_Traces then
64         Trace_S (1 .. 3) := "/N:";
65         Trace_S (4 .. 3 + Task_S'Length) := Task_S;
66         Trace_S (4 + Task_S'Length .. 6 + Task_S'Length) := "/T:";
67         Trace_S (7 + Task_S'Length .. Trace_S'Last) := Timeout_S;
68         Send_Trace (Id, Trace_S);
69      end if;
70   end Send_Trace_Info;
71end System.Traces;
72