Commit b359958f authored by yoogx's avatar yoogx

* Normalize time value to microseconds

        For openaadl/ocarina#109
parent a069b2e2
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2010-2015 ESA & ISAE. -- -- Copyright (C) 2010-2017 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify under -- -- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -207,7 +207,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -207,7 +207,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
Make_Defining_Identifier (Get_String_Name ("quantum")); Make_Defining_Identifier (Get_String_Name ("quantum"));
Value : constant Node_Id := Value : constant Node_Id :=
Make_Literal Make_Literal
(XV.New_Numeric_Value (To_Milliseconds (Quantum), 1, 10)); (XV.New_Numeric_Value (To_Microseconds (Quantum), 1, 10));
begin begin
Append_Node_To_List Append_Node_To_List
(Make_Assignement (Name, Value), (Make_Assignement (Name, Value),
...@@ -327,7 +327,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -327,7 +327,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
K := K :=
Make_Literal Make_Literal
(XV.New_Numeric_Value (XV.New_Numeric_Value
(To_Milliseconds (To_Microseconds
(Get_Execution_Time (Get_Execution_Time
(Corresponding_Instance (Corresponding_Instance
(Item (Item
...@@ -506,7 +506,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -506,7 +506,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
P := P :=
Map_To_XML_Node Map_To_XML_Node
("capacity", ("capacity",
To_Milliseconds (Get_Execution_Time (E) (1))); To_Microseconds (Get_Execution_Time (E) (1)));
end if; end if;
Append_Node_To_List (P, XTN.Subitems (N)); Append_Node_To_List (P, XTN.Subitems (N));
...@@ -514,7 +514,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -514,7 +514,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
P := P :=
Map_To_XML_Node Map_To_XML_Node
("start_time", ("start_time",
To_Milliseconds (Get_Thread_First_Dispatch_Time (E))); To_Microseconds (Get_Thread_First_Dispatch_Time (E)));
Append_Node_To_List (P, XTN.Subitems (N)); Append_Node_To_List (P, XTN.Subitems (N));
-- policy: computed from the POSIX_Scheduling_Policy properties -- policy: computed from the POSIX_Scheduling_Policy properties
...@@ -528,7 +528,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -528,7 +528,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
P := P :=
Map_To_XML_Node Map_To_XML_Node
("deadline", ("deadline",
To_Milliseconds (Get_Thread_Deadline (E))); To_Microseconds (Get_Thread_Deadline (E)));
Append_Node_To_List (P, XTN.Subitems (N)); Append_Node_To_List (P, XTN.Subitems (N));
end if; end if;
...@@ -554,7 +554,7 @@ package body Ocarina.Backends.Cheddar.Mapping is ...@@ -554,7 +554,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
if Dispatch = Thread_Periodic or else Dispatch = Thread_Sporadic then if Dispatch = Thread_Periodic or else Dispatch = Thread_Sporadic then
-- period: computed from Period property, XXX check units -- period: computed from Period property, XXX check units
P := P :=
Map_To_XML_Node ("period", To_Milliseconds (Get_Thread_Period (E))); Map_To_XML_Node ("period", To_Microseconds (Get_Thread_Period (E)));
Append_Node_To_List (P, XTN.Subitems (N)); Append_Node_To_List (P, XTN.Subitems (N));
end if; end if;
......
...@@ -2871,6 +2871,15 @@ package body Ocarina.Backends.Utils is ...@@ -2871,6 +2871,15 @@ package body Ocarina.Backends.Utils is
return Unsigned_Long_Long (To_Seconds (S) * 1_000.0); return Unsigned_Long_Long (To_Seconds (S) * 1_000.0);
end To_Milliseconds; end To_Milliseconds;
---------------------
-- To_Microseconds --
---------------------
function To_Microseconds (S : Time_Type) return Unsigned_Long_Long is
begin
return Unsigned_Long_Long (To_Seconds (S) * 1_000_000.0);
end To_Microseconds;
--------------------- ---------------------
-- To_Nanoseconds -- -- To_Nanoseconds --
--------------------- ---------------------
......
...@@ -423,6 +423,7 @@ package Ocarina.Backends.Utils is ...@@ -423,6 +423,7 @@ package Ocarina.Backends.Utils is
function To_Seconds (S : Time_Type) return Long_Double; function To_Seconds (S : Time_Type) return Long_Double;
function To_Milliseconds (S : Time_Type) return Unsigned_Long_Long; function To_Milliseconds (S : Time_Type) return Unsigned_Long_Long;
function To_Microseconds (S : Time_Type) return Unsigned_Long_Long;
function To_Nanoseconds (S : Time_Type) return Unsigned_Long_Long; function To_Nanoseconds (S : Time_Type) return Unsigned_Long_Long;
function Get_Accessed_Data (Data_Access : Node_Id) return Node_Id; function Get_Accessed_Data (Data_Access : Node_Id) return Node_Id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment