OSDN Git Service

PR preprocessor/30805:
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-exetim.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --                   A D A . E X E C U T I O N _ T I M E                    --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 -- This specification is derived from the Ada Reference Manual for use with --
10 -- GNAT.  In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification,  provided that if you redistribute a --
12 -- modified version,  any changes that you have made are clearly indicated. --
13 --                                                                          --
14 ------------------------------------------------------------------------------
15
16 --  This unit is not implemented in typical GNAT implementations that lie on
17 --  top of operating systems, because it is infeasible to implement in such
18 --  environments.
19
20 --  If a target environment provides appropriate support for this package
21 --  then the Unimplemented_Unit pragma should be removed from this spec and
22 --  an appropriate body provided.
23
24 with Ada.Task_Identification;
25 with Ada.Real_Time;
26
27 package Ada.Execution_Time is
28    pragma Preelaborate;
29
30    pragma Unimplemented_Unit;
31
32    type CPU_Time is private;
33
34    CPU_Time_First : constant CPU_Time;
35    CPU_Time_Last  : constant CPU_Time;
36    CPU_Time_Unit  : constant := 0.000001;
37    CPU_Tick       : constant Ada.Real_Time.Time_Span;
38
39    function Clock
40      (T : Ada.Task_Identification.Task_Id
41           := Ada.Task_Identification.Current_Task)
42       return CPU_Time;
43
44    function "+"
45      (Left  : CPU_Time;
46       Right : Ada.Real_Time.Time_Span) return CPU_Time;
47
48    function "+"
49      (Left  : Ada.Real_Time.Time_Span;
50       Right : CPU_Time) return CPU_Time;
51
52    function "-"
53      (Left  : CPU_Time;
54       Right : Ada.Real_Time.Time_Span) return CPU_Time;
55
56    function "-"
57      (Left  : CPU_Time;
58       Right : CPU_Time) return Ada.Real_Time.Time_Span;
59
60    function "<"  (Left, Right : CPU_Time) return Boolean;
61    function "<=" (Left, Right : CPU_Time) return Boolean;
62    function ">"  (Left, Right : CPU_Time) return Boolean;
63    function ">=" (Left, Right : CPU_Time) return Boolean;
64
65    procedure Split
66      (T  : CPU_Time;
67       SC : out Ada.Real_Time.Seconds_Count;
68       TS : out Ada.Real_Time.Time_Span);
69
70    function Time_Of
71       (SC : Ada.Real_Time.Seconds_Count;
72        TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero)
73        return CPU_Time;
74
75 private
76
77    type CPU_Time is new Ada.Real_Time.Time;
78
79    CPU_Time_First : constant CPU_Time  := CPU_Time (Ada.Real_Time.Time_First);
80    CPU_Time_Last  : constant CPU_Time  := CPU_Time (Ada.Real_Time.Time_Last);
81
82    CPU_Tick : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Tick;
83
84 end Ada.Execution_Time;