Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: RandomTiger on October 05, 2002, 11:44:54 am

Title: Use new timer bars to optimize code
Post by: RandomTiger on October 05, 2002, 11:44:54 am
Some if you may have seen something like this before.
If you have take a look at the code because I know I havent got it entirely right yet.

(http://www.ijbrooks.demon.co.uk/tom/bars.jpg)

Basically the bars represent the amount of progessing time spent on everything that needs to be done to prepare and render each frame. Using carefully placed code you can use different coloured bars to measure different bits in the code.

I believe in the above pic green is graphics code and red is everything else.

To activate it you have to put TIMEBAR_ACTIVE in the main project and dependancy code settings.
Title: Use new timer bars to optimize code
Post by: phreak on October 05, 2002, 11:55:26 am
is that in DX8?
Title: Use new timer bars to optimize code
Post by: RandomTiger on October 05, 2002, 12:14:36 pm
Good question. No, its just in the main branch.
I should have mad ehtat clear.
Title: Use new timer bars to optimize code
Post by: Fry_Day on October 05, 2002, 03:18:13 pm
so that's basically integrated timing code like Good ol' Zen Timer for DOS?
Title: Use new timer bars to optimize code
Post by: Bobboau on October 05, 2002, 08:27:53 pm
so what is this? :wtf:
Title: Use new timer bars to optimize code
Post by: Fry_Day on October 05, 2002, 11:27:43 pm
Bobbau, by using that code, you can measure how long each bit of code takes during runtime, and know what needs the most optimizing (If input takes 4% of the processing time per frame, it's not worth optimizing, since the gains would be marginal, yet if it takes 20%of the processing time, it's a totally different story)
Title: Use new timer bars to optimize code
Post by: RandomTiger on October 06, 2002, 04:58:55 am
When you see it running you'll get it.
Its soo much better than numbers.

Also the code is quite cool because its not DX specific, it takes a function pointer to the draw code so you can set it up to run in OGL or even Glide.

If you want to optimise you will want to use this feature.
Also its useful for checking new stuff you are putting in itsnt bringing hte framerate down too much.

Theres lots of things that could be done to provide more functionality. An averaging mode would be good for identifing 'spikes'. Spikes are large amounts of processing in a very small time, usually a sign your engine is doing something at run time that should be done at load.

This tool seems to be standard practice for most games and real time graphical systems. NASA guy used to have one for his stuff apparently.