Page 1 of 1

Question about ZApplication.Time

Posted: Thu Oct 18, 2012 6:17 pm
by Rado1
I tried to use ZApplication.Time to measure duration of computation of a code in one ZExpression. The duration was always 0, so the value of ZApplication.Time did not change even during several seconds of computation. Is ZApplication.Time updated only once in update-render cycle? How to solve my problem of measuring duration of execution? I would like to avoid calling of Win32 routines or adding additional Timer components. Cannot, e.g., the ZApplication.Time be updated each time the program asks for its value?

Re: Question about ZApplication.Time

Posted: Thu Oct 18, 2012 6:30 pm
by Kjell
Hi Rado,
Rado1 wrote:I tried to use ZApplication.Time to measure duration of computation of a code in one ZExpression. The duration was always 0, so the value of ZApplication.Time did not change even during several seconds of computation. Is ZApplication.Time updated only once in update-render cycle?
Yes, it is updated once per frame ( would be a waste of cycles if it was updated more often ).
Rado1 wrote:How to solve my problem of measuring duration of execution? I would like to avoid calling of Win32 routines or adding additional Timer components.
What do you need this for? If you're trying to throttle steams depending on the users' CPU, you could do a ( multi-frame ) speed test on start-up and then use that result for the rest of the game.

K

Re: Question about ZApplication.Time

Posted: Thu Oct 18, 2012 8:50 pm
by Rado1
Hi Kjell,
Kjell wrote:What do you need this for?
I wanted to know exact speed of loading and processing OBJ files as part of algorithm optimization discussed in this thread. Anyway, I did a workaround and printing the loading time in a next cycle (which is not very nice because I need another variable); see my next version of the obj loader in that thread coming soon.

Posted: Thu Oct 18, 2012 9:43 pm
by Kjell
Ah,

For benchmarking i usually just execute alternative solutions X* amount of time ( in a single frame ) and compare the framerate. As long as the overhead of the loop is identical for both this is a good way to determine which is faster.

*A amount that causes the framerate of one solution to be around 20 or so. Depending on what you're testing this can be 10 or 1.000.000 times.

K