111
|
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 with
|
|
28 SPARK_Mode
|
|
29 is
|
|
30 pragma Preelaborate;
|
|
31
|
|
32 pragma Unimplemented_Unit;
|
|
33
|
|
34 type CPU_Time is private;
|
|
35
|
|
36 CPU_Time_First : constant CPU_Time;
|
|
37 CPU_Time_Last : constant CPU_Time;
|
|
38 CPU_Time_Unit : constant := 0.000001;
|
|
39 CPU_Tick : constant Ada.Real_Time.Time_Span;
|
|
40
|
|
41 use type Ada.Task_Identification.Task_Id;
|
|
42
|
|
43 function Clock
|
|
44 (T : Ada.Task_Identification.Task_Id :=
|
|
45 Ada.Task_Identification.Current_Task)
|
|
46 return CPU_Time
|
|
47 with
|
|
48 Volatile_Function,
|
|
49 Global => Ada.Real_Time.Clock_Time,
|
|
50 Pre => T /= Ada.Task_Identification.Null_Task_Id;
|
|
51
|
|
52 function "+"
|
|
53 (Left : CPU_Time;
|
|
54 Right : Ada.Real_Time.Time_Span) return CPU_Time
|
|
55 with
|
|
56 Global => null;
|
|
57
|
|
58 function "+"
|
|
59 (Left : Ada.Real_Time.Time_Span;
|
|
60 Right : CPU_Time) return CPU_Time
|
|
61 with
|
|
62 Global => null;
|
|
63
|
|
64 function "-"
|
|
65 (Left : CPU_Time;
|
|
66 Right : Ada.Real_Time.Time_Span) return CPU_Time
|
|
67 with
|
|
68 Global => null;
|
|
69
|
|
70 function "-"
|
|
71 (Left : CPU_Time;
|
|
72 Right : CPU_Time) return Ada.Real_Time.Time_Span
|
|
73 with
|
|
74 Global => null;
|
|
75
|
|
76 function "<" (Left, Right : CPU_Time) return Boolean with
|
|
77 Global => null;
|
|
78 function "<=" (Left, Right : CPU_Time) return Boolean with
|
|
79 Global => null;
|
|
80 function ">" (Left, Right : CPU_Time) return Boolean with
|
|
81 Global => null;
|
|
82 function ">=" (Left, Right : CPU_Time) return Boolean with
|
|
83 Global => null;
|
|
84
|
|
85 procedure Split
|
|
86 (T : CPU_Time;
|
|
87 SC : out Ada.Real_Time.Seconds_Count;
|
|
88 TS : out Ada.Real_Time.Time_Span)
|
|
89 with
|
|
90 Global => null;
|
|
91
|
|
92 function Time_Of
|
|
93 (SC : Ada.Real_Time.Seconds_Count;
|
|
94 TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero)
|
|
95 return CPU_Time
|
|
96 with
|
|
97 Global => null;
|
|
98
|
|
99 Interrupt_Clocks_Supported : constant Boolean := False;
|
|
100 Separate_Interrupt_Clocks_Supported : constant Boolean := False;
|
|
101
|
|
102 pragma Warnings (Off, "check will fail at run time");
|
|
103 function Clock_For_Interrupts return CPU_Time with
|
|
104 Volatile_Function,
|
|
105 Global => Ada.Real_Time.Clock_Time,
|
|
106 Pre => Interrupt_Clocks_Supported;
|
|
107 pragma Warnings (On, "check will fail at run time");
|
|
108
|
|
109 private
|
|
110 pragma SPARK_Mode (Off);
|
|
111
|
|
112 type CPU_Time is new Ada.Real_Time.Time;
|
|
113
|
|
114 CPU_Time_First : constant CPU_Time := CPU_Time (Ada.Real_Time.Time_First);
|
|
115 CPU_Time_Last : constant CPU_Time := CPU_Time (Ada.Real_Time.Time_Last);
|
|
116
|
|
117 CPU_Tick : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Tick;
|
|
118
|
|
119 end Ada.Execution_Time;
|