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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71d1e36fcaaa9b90 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-11 08:07:04 PST From: Dmitriy Anisimkov Newsgroups: comp.lang.ada Subject: Re: Help with anormal pausing of program Date: Wed, 11 Jun 2003 21:31:07 +0700 Organization: A poorly-installed InterNetNews site Distribution: world Message-ID: <3EE73D2B.4010502@yahoo.com> References: NNTP-Posting-Host: 195.162.53.2 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ns.omskelecom.ru 1055341811 11872 195.162.53.2 (11 Jun 2003 14:30:11 GMT) X-Complaints-To: usenet@ns.omskelecom.ru NNTP-Posting-Date: Wed, 11 Jun 2003 14:30:11 +0000 (UTC) To: Jano User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en In-Reply-To: Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!skynet.be!skynet.be!news.csl-gmbh.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in.nuthinbutnews.com!news.rosprint.net!radius!not-for-mail Xref: archiver1.google.com comp.lang.ada:38988 Date: 2003-06-11T21:31:07+07:00 List-Id: Jano wrote: > The problem is that I've detected that some (many) of these tasks are > being stopped for unusual long times, after some running time. It seems > like I issue a delay 1.0 but they sleep for much more. I haven't find > any deadlock or critical race condition anywhere, CPU usage is idle. I had the same problem. It was becouse of wrong result from QueryPerformcnceCounter Win32 API call on some hardware configurations. GNAT for Win32 is counting time by using QueryPerformcnceCounter call. Some hardware configurations could make this counter to be wrong sometimes. See article in the MSDN http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B274323 it is talking about leap counter forward, and contain program in C to detect it. I was encounter the leap counter backward, and wrote program in Ada to detect it. See the sources to understand how to use it. Very short description is: Press a key '1' then counter would checked 10000 times for the next counter is bigger than previous, if it is not so the message [prev_counter] > [next_counter] would appear. Press '2' the same checking would be 20000, etcetera till '9' ------------------------------------ with System.OS_Interface; with Ada.Text_IO; procedure Time is use Ada.Text_IO; use System.OS_Interface; Perf_Freq : aliased LARGE_INTEGER; Curr_Counter, Prev_Counter : aliased LARGE_INTEGER; Char : Character; Pass : Natural := 0; Max_Diff : LARGE_INTEGER := 0.0; Diff : LARGE_INTEGER; procedure Check (Item : BOOL); pragma Inline (Check); procedure Check (Item : BOOL) is begin if not Item then raise Program_Error; end if; end Check; begin Check (QueryPerformanceFrequency (Perf_Freq'Access)); Put_Line (LARGE_INTEGER'Image (Perf_Freq)); Check (QueryPerformanceCounter (Prev_Counter'Access)); loop Check (QueryPerformanceCounter (Curr_Counter'Access)); Diff := Curr_Counter - Prev_Counter; if Diff < 0.0 then Put_Line (LARGE_INTEGER'Image (Prev_Counter) & " >" & LARGE_INTEGER'Image (Curr_Counter)); elsif Diff > Max_Diff then Max_Diff := Diff; end if; Prev_Counter := Curr_Counter; if Pass = 0 then Get_Immediate (Char); case Char is when '0' => Put_Line (LARGE_INTEGER'Image (Curr_Counter)); when 'f' | 'F' => Check (QueryPerformanceFrequency (Perf_Freq'Access)); Put_Line (LARGE_INTEGER'Image (Perf_Freq)); when '1' .. '9' => Pass := Integer'Value ("" & Char) * 10000; Max_Diff := 0.0; Check (QueryPerformanceCounter (Prev_Counter'Access)); when 'q' | 'Q' => exit; when others => Put (Char); end case; else Pass := Pass - 1; if Pass = 0 then Put_Line (LARGE_INTEGER'Image (Curr_Counter) & LARGE_INTEGER'Image (Max_Diff)); end if; end if; end loop; end Time; -----------------------------------