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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88aaef9110656b58 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-12 06:51:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!small.news.tele.dk!207.115.63.138!newscon04.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr30.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <17cd177c.0110120321.3077bccf@posting.google.com> Subject: Re: CPU time for Win32 & GNAT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 208.191.176.121 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr30.news.prodigy.com 1002894612 ST000 208.191.176.121 (Fri, 12 Oct 2001 09:50:12 EDT) NNTP-Posting-Date: Fri, 12 Oct 2001 09:50:12 EDT Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: SCSYQN_@OXRQRILY@BJZ\_TDFRYB@GXLN@GZ_GYO^JWTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN Date: Fri, 12 Oct 2001 13:50:12 GMT Xref: archiver1.google.com comp.lang.ada:14395 Date: 2001-10-12T13:50:12+00:00 List-Id: "Gautier" wrote in message news:17cd177c.0110120321.3077bccf@posting.google.com... > Hi! > > Does someone know how to obtain the CPU time (or a CPU > duration...) for Win32 (under GNAT) in a simple way ? > The program doesn't use tasking and no more resolution > than the one of Duration is needed for time spans. > I'm sure someone has a ready-made function in his/her toolbox... Better yet, why not use the Pentium ReadTimeStampCounter (RDTSC) instruction? It samples the register that keeps a count of the number of clock cycles since boot-up. Given the exact clock speed you can compute exactly how much time has elapsed between two samples. with Interfaces; package Pentium_Cycle_Counter is pragma Suppress( All_Checks ); type Count is new Interfaces.Unsigned_64; function Sample return Count; pragma Inline( Sample ); end Pentium_Cycle_Counter; with Machine_Code; package body Pentium_Cycle_Counter is use Machine_Code; function Sample return Count is Result : Count; begin Asm( "RDTSC", Count'Asm_Output("=A",Result), Volatile => True ); return Result; end Sample; end Pentium_Cycle_Counter; --- Patrick Rogers Consulting and Training in: http://www.classwide.com Real-Time/OO Languages progers@classwide.com Hard Deadline Schedulability Analysis (281)648-3165 Software Fault Tolerance