Re: Task Management



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
.



Relevant Pages

  • Re: Ada.Strings.Bounded
    ... Dmitry> If compilable. ... The following should break GNAT GPL 2007: ... It doesn't break GCC 4.4.0: ... I have added 30 lines to each summand and got the infamous: GNAT BUG ...
    (comp.lang.ada)
  • Re: Enumeration type - GNAT 3.15p bug?
    ... Dmitry A. Kazakov schrieb: ... GNAT 3.15p: ... raised CONSTRAINT_ERROR: jenumxa.adb:8 overflow check failed ...
    (comp.lang.ada)
  • Re: Howto read line from a stream
    ... Dmitry A. Kazakov a écrit: ... GNAT makes this efficiently as there ... is some internal buffer so the string is not reallocated for each and ...
    (comp.lang.ada)
  • Re: GNAT subunit naming
    ... Dmitry A. Kazakov wrote: ... Those are the files that GNAT looks for by default, yes, ... filenames I specify. ...
    (comp.lang.ada)