upbge
upbge copied to clipboard
Improve performance debuging.
For more than a year (the beginning of the project) we got really hard problems to determine the time spent by the game engine in some categories.
Some of the issue are the following:
- The profile time precision is limited to only 4 digits in ms units.
- Comparing the time by FPS is uncertain as the 5 fps gap for 60 fps is not the same as 5 fps gap for 200fps.
- The profile average the time value of the last 50 frames
- When displaying the profile the FPS decrease
I propose some solutions to fix these issues:
- Use a variable time unit and point to display the maximum of the 4 digits, e.g : 5.001µs; 520.6ms; 0.590ms
- Return frame time without average in python function getProfileDict()
- Display three time average numbers as OS load, first for frame time, second for average time of 50 last frames, third for average time of 100 last frames.
- Display the theorical FPS based on frame time without profile draw time.
@youle31, @lordloki, @DCubix : I haven't wrote something for the moment, what do you think, do you have ideas ?
http://gafferongames.com/game-physics/fix-your-timestep/
Current state of branch ge_profiler
:
Currently it expose the time of the current frame and the averages for 25 and 100 frames (25 is for compatibility). The a color is selected depending on the percentage of a a category, green, yellow or red. Also the unit is selected automatically to get the better precision: µs, ms or s.
What do you think about this ?
This is cool :) Some remarks/ideas:
- an idea would make the color depend on percentage.
- the red color isn't visible enough in my opinion
- as profiler drawing takes a lot of performances itself, we could make a custom function in blf.c for bge to avoid to save matrix mode (and the more we have text, the slower it is): /* Save the current matrix mode. */ glGetIntegerv(GL_MATRIX_MODE, mode); which costs a lot of performances and which we don't need as we push/pop matrix ourselves in RAS_OpenGLDebugDraw iirc
- I'd prefer to keep all in milliseconds
Sorry to interupt, but is it possible to get v-ram and system swapping(hard drive) usage in there somehow?
This can also have a large impact on performance if your video card needs to using the hard drive...I'm really not sure of all the internals of the game engine..