Question about ZApplication.Time

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Question about ZApplication.Time

Post 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?
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Re: Question about ZApplication.Time

Post 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
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Question about ZApplication.Time

Post 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.
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
Post Reply