comp.lang.ada
 help / color / mirror / Atom feed
* Re: Timing of ADA code
@ 1998-07-31  0:00 tmoran
  0 siblings, 0 replies; 9+ messages in thread
From: tmoran @ 1998-07-31  0:00 UTC (permalink / raw)


On Windows 95, for high resolution timing, you might want to
use QueryPerformanceCounter.  With many caveats.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-07-31  0:00   ` Brian Franklin
@ 1998-07-31  0:00     ` dennison
  1998-07-31  0:00       ` Brian Franklin
  0 siblings, 1 reply; 9+ messages in thread
From: dennison @ 1998-07-31  0:00 UTC (permalink / raw)


In article <35c1cf02.40761361@news.gatech.edu>,
  bf14@prism.gatech.edu (Brian Franklin) wrote:
> On Fri, 31 Jul 1998 13:15:17 GMT, dennison@telepath.com wrote:
>
> >In article <35c12689.217545056@news.gatech.edu>,
> >  bf14@prism.gatech.edu (Brian Franklin) wrote:
> >> I want to measure the execution time of portions of my ADA code. What
> >> code do I need to add the my code to do this?
> >>
> >> I'm using GNAT on a PC.
> >>
> >
> >What OS?
> Windows 95
> >
> >CPU time or wall time?
> CPU
> (What's wall time?)
The actual time elapsed (including time spent doing nothing while another
process or task is executing). iaw: The time elapsed as reported by the clock
on the wall.

Ada gives you a standard way to get "wall" time, but you will have to make OS
calls to get CPU time. That turns your question into:

 "How do I get CPU time for a thread in Windows 95?", which is a better
question for a win32 newsgroup,
and possibly:
 "How do I get my Win95 thread ID in gnat?", which is appropriate here.

T.E.D.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-07-31  0:00     ` dennison
@ 1998-07-31  0:00       ` Brian Franklin
  1998-08-01  0:00         ` Jerry van Dijk
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Franklin @ 1998-07-31  0:00 UTC (permalink / raw)


On Fri, 31 Jul 1998 16:49:15 GMT, dennison@telepath.com wrote:

>In article <35c1cf02.40761361@news.gatech.edu>,
>  bf14@prism.gatech.edu (Brian Franklin) wrote:
>> On Fri, 31 Jul 1998 13:15:17 GMT, dennison@telepath.com wrote:
>>
>> >In article <35c12689.217545056@news.gatech.edu>,
>> >  bf14@prism.gatech.edu (Brian Franklin) wrote:
>> >> I want to measure the execution time of portions of my ADA code. What
>> >> code do I need to add the my code to do this?
>> >>
>> >> I'm using GNAT on a PC.
>> >>
>> >
>> >What OS?
>> Windows 95
>> >
>> >CPU time or wall time?
>> CPU
>> (What's wall time?)
>The actual time elapsed (including time spent doing nothing while another
>process or task is executing). iaw: The time elapsed as reported by the clock
>on the wall.
>
>Ada gives you a standard way to get "wall" time, but you will have to make OS
>calls to get CPU time. That turns your question into:
>

OK, In that case "wall" time will do. My PC has a dedicated processor
and hopefully any other tasks it chooses to do (if done) will not
affect the result. I guess basically I just need the time when the
process starts and the time when it finishes. 






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Timing of ADA code
@ 1998-07-31  0:00 Brian Franklin
       [not found] ` <6psg15$a56$1@nnrp1.dejanews.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Franklin @ 1998-07-31  0:00 UTC (permalink / raw)


I want to measure the execution time of portions of my ADA code. What
code do I need to add the my code to do this?

I'm using GNAT on a PC.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
       [not found] ` <6psg15$a56$1@nnrp1.dejanews.com>
@ 1998-07-31  0:00   ` Brian Franklin
  1998-07-31  0:00     ` dennison
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Franklin @ 1998-07-31  0:00 UTC (permalink / raw)


On Fri, 31 Jul 1998 13:15:17 GMT, dennison@telepath.com wrote:

>In article <35c12689.217545056@news.gatech.edu>,
>  bf14@prism.gatech.edu (Brian Franklin) wrote:
>> I want to measure the execution time of portions of my ADA code. What
>> code do I need to add the my code to do this?
>>
>> I'm using GNAT on a PC.
>>
>
>What OS?
Windows 95
>
>CPU time or wall time?
CPU  
(What's wall time?)
>
>T.E.D.
>

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-07-31  0:00       ` Brian Franklin
@ 1998-08-01  0:00         ` Jerry van Dijk
  1998-08-01  0:00           ` Brian Franklin
  0 siblings, 1 reply; 9+ messages in thread
From: Jerry van Dijk @ 1998-08-01  0:00 UTC (permalink / raw)


Brian Franklin (bf14@prism.gatech.edu) wrote:

: OK, In that case "wall" time will do. My PC has a dedicated processor
: and hopefully any other tasks it chooses to do (if done) will not
: affect the result.

Since you are running Win95, the processor will switch between processes
and theads every 20 milliseconds.

: I guess basically I just need the time when the
: process starts and the time when it finishes. 

For that you can use the functions from the package Calendar. 

But, the time you measure includes the time spend on all other processes
and threads running on you PC at the same time. So, it boils down to
how accurate you need to measure.

Jerry.

-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-08-01  0:00         ` Jerry van Dijk
@ 1998-08-01  0:00           ` Brian Franklin
  1998-08-01  0:00             ` Tom Moran
  1998-08-03  0:00             ` dennison
  0 siblings, 2 replies; 9+ messages in thread
From: Brian Franklin @ 1998-08-01  0:00 UTC (permalink / raw)


On Sat, 1 Aug 1998 08:16:35 GMT, jerry@jvdsys.nextjk.stuyts.nl (Jerry
van Dijk) wrote:

>Brian Franklin (bf14@prism.gatech.edu) wrote:
>
>: OK, In that case "wall" time will do. My PC has a dedicated processor
>: and hopefully any other tasks it chooses to do (if done) will not
>: affect the result.
>
>Since you are running Win95, the processor will switch between processes
>and theads every 20 milliseconds.
>
>: I guess basically I just need the time when the
>: process starts and the time when it finishes. 
>
>For that you can use the functions from the package Calendar. 
>
>But, the time you measure includes the time spend on all other processes
>and threads running on you PC at the same time. So, it boils down to
>how accurate you need to measure.
>
  Since I am comparing algorithms and if each suffers from the same
switching between processes, I think the "wall" time will still do.
In other words, if the switching process is the same when I run each
algorithm a normalization of the result could still prove useful.

  I looked at Calendar but if I understand the interface it appears
that I can only get a accuracy to seconds and I would like to get at
least 1/100 of a second.  I think the problem is the same with package
Real_Time.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-08-01  0:00           ` Brian Franklin
@ 1998-08-01  0:00             ` Tom Moran
  1998-08-03  0:00             ` dennison
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Moran @ 1998-08-01  0:00 UTC (permalink / raw)


>Calendar but if I understand the interface it appears
>that I can only get a accuracy to seconds
That depends on the run time system your compiler vendor supplies.
Are you sure that Ada.Calendar.Clock only ticks once/second?  Once
every 55 milliseconds is what Win95 supplies so a vendor would almost
have to work to throw away accuracy.  Note that Day_Duration is a
fixed point type with a delta probably (much) less than 1.0 seconds.
But even if it is in seconds, can't you just time 100 iterations of
the thing you want to time, then divide the elapsed time by 100?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Timing of ADA code
  1998-08-01  0:00           ` Brian Franklin
  1998-08-01  0:00             ` Tom Moran
@ 1998-08-03  0:00             ` dennison
  1 sibling, 0 replies; 9+ messages in thread
From: dennison @ 1998-08-03  0:00 UTC (permalink / raw)


In article <35c37492.148697454@news.gatech.edu>,
  bf14@prism.gatech.edu (Brian Franklin) wrote:
>   I looked at Calendar but if I understand the interface it appears
> that I can only get a accuracy to seconds and I would like to get at
> least 1/100 of a second.  I think the problem is the same with package
> Real_Time.
>

Look a little closer. The "seconds" it returns is a fixed-point (real) type,
not an integer. The exect accuracy should be spelled out in your compiler
documentation somewhere.

T.E.D.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-08-03  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-31  0:00 Timing of ADA code tmoran
  -- strict thread matches above, loose matches on Subject: below --
1998-07-31  0:00 Brian Franklin
     [not found] ` <6psg15$a56$1@nnrp1.dejanews.com>
1998-07-31  0:00   ` Brian Franklin
1998-07-31  0:00     ` dennison
1998-07-31  0:00       ` Brian Franklin
1998-08-01  0:00         ` Jerry van Dijk
1998-08-01  0:00           ` Brian Franklin
1998-08-01  0:00             ` Tom Moran
1998-08-03  0:00             ` dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox