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-Thread: 103376,1d629cbff6c439a6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news.uni-stuttgart.de!carbon.eu.sun.com!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: Martin Dowie Newsgroups: comp.lang.ada Subject: Re: Task Management Date: Wed, 28 Dec 2005 12:55:39 +0000 (UTC) Organization: BT Openworld Message-ID: References: <1135769272.690177.182630@g47g2000cwa.googlegroups.com> NNTP-Posting-Host: host86-142-136-239.range86-142.btcentralplus.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com 1135774539 9941 86.142.136.239 (28 Dec 2005 12:55:39 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Wed, 28 Dec 2005 12:55:39 +0000 (UTC) In-Reply-To: X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) Xref: g2news1.google.com comp.lang.ada:2383 Date: 2005-12-28T12:55:39+00:00 List-Id: Dmitry A. Kazakov wrote: > On 28 Dec 2005 03:27:52 -0800, The One Who Rages wrote: > > >>I am new to ada. > > > You are welcome, though the following is not Ada question. > > >>I am trying to develop a simple system for managing >>different(predefined) tasks. >>I need to know time consumption for each task(f.e task with id 1 used >>213 ms of processor). Could anyone point me vision of solution? >>I can estimate of course, but it is not sattisfactying me. >> >>I work under winXP, with gnat compiler. > > > See Win32 API procedure GetThreadTimes in MSDN. GNAT Ada tasks are most > likely mapped to Windows threads. Call GetCurrentThread once from a task to > identify it. The result is a pseudo handle. Use DuplicateHandle on it to > get another (true) handle to the thread. This one can be used outside it > (in another task.) > > P.S. GNAT has Win32 bindings. For Ada2005 there will be a new package "Ada.Execution_Time". I have a version of this that works with ObjectAda (i.e. Ada95) but not currently with GNAT. If anyone is interested in this, please email me. Perhaps I'll update my website someday! :-) I'll see if I can update it to use a general solution using the above method described by Dmitry. Cheers -- Martin