From 4e1c7b340033f214ee03aca08bc8cbb76316c1b6 Mon Sep 17 00:00:00 2001 From: "hugues.jerome" Date: Thu, 8 Jul 2010 08:20:30 +0000 Subject: [PATCH] * Add an observer to check the user code is not overloading us git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-ada@958 129961e7-ef38-4bb5-a8f7-c9a525a55882 --- src/polyorb_hi-periodic_task.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/polyorb_hi-periodic_task.adb b/src/polyorb_hi-periodic_task.adb index 96685b0..05bf157 100644 --- a/src/polyorb_hi-periodic_task.adb +++ b/src/polyorb_hi-periodic_task.adb @@ -48,6 +48,7 @@ package body PolyORB_HI.Periodic_Task is task body The_Periodic_Task is Next_Start : Ada.Real_Time.Time; + T : Ada.Real_Time.Time; Error : Error_Kind; begin @@ -86,6 +87,15 @@ package body PolyORB_HI.Periodic_Task is Recover_Entrypoint; end if; + T := Ada.Real_Time.Clock; + if T > Next_Start then + Put_Line (Normal, "***** Overload detected *****"); + Put_Line (Normal, "Lag: " & + Duration'Image (To_Duration (Next_Start - T))); + + raise Program_Error; + end if; + delay until Next_Start; Next_Start := Next_Start + Task_Period; Next_Deadline_Val := Ada.Real_Time.Clock + Task_Deadline; -- GitLab