From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,311fb0646ddb2845,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Task execution time 2 Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH Date: Thu, 30 Dec 2010 09:54:36 +0100 Message-ID: NNTP-Posting-Date: 30 Dec 2010 09:54:34 CET NNTP-Posting-Host: f6da10dc.newsspool3.arcor-online.net X-Trace: DXC=Rnh[3ZWI[LTYI9]OHn9o5^McF=Q^Z^V3X4Fo<]lROoRQ8kFj;Pm;;;;Qg9gJ:RGAPMZ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:17215 Date: 2010-12-30T09:54:34+01:00 List-Id: Here is a better test for the thing. It measures the execution time using real-time clock and Windows services. The idea is to give up the processor after 0.5ms, before the system time quant expires. The test must run considerably long time. Because the task Measured should lose the processor each 0.5ms and return back after other tasks would take their share. If the test completes shortly, that possibly mean something wrong. Increase the number of worker task. ---------------------------------------------------------------- with Ada.Execution_Time; use Ada.Execution_Time; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Elementary_Functions; procedure Executuion_Time_1 is task type Measured; task body Measured is Count : Seconds_Count; Fraction : Time_Span; Estimated : Time_Span := Time_Span_Zero; Start : Time; begin for I in 1..1_000 loop Start := Clock; while To_Duration (Clock - Start) < 0.000_5 loop null; end loop; Estimated := Estimated + Clock - Start; delay 0.0; end loop; Split (Ada.Execution_Time.Clock, Count, Fraction); Put_Line ( "Measured: seconds" & Seconds_Count'Image (Count) & " Fraction " & Duration'Image (To_Duration (Fraction)) ); Put_Line ( "Estimated:" & Duration'Image (To_Duration (Estimated)) ); end Measured; task type Worker; -- Used to generate CPU load task body Worker is use Ada.Numerics.Elementary_Functions; X : Float; begin for I in Positive'Range loop X := sin (Float (I)); end loop; end Worker; begin delay 0.1; declare Workers : array (1..5) of Worker; Test : Measured; begin null; end; end Executuion_Time_1; ----------------------------------------------------------- Windows XP SP3 Measured: seconds 0 Fraction 0.000000000 Estimated: 0.690618774 -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de