[3.4] Profiling - fix frame_time measurement #51138
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the
sync_after_draw
feature was on it was possible for the profiler'sframe_time
measurement to be incorrect. This fixes this problem by storing the raw measured time for use by the profiler.Notes
sync_after_draw
is on, doesn't affect behaviour.Discussion
I've been taking a quick look at the general area of the timing profiling as a result of the discussion in #48555. The current profiling could be improved but it needs a bit of time spending on it, more than I wanted to do in this PR.
A few things to note:
time
is used both to denote an absolute time, and a delta, for instance).float
is used which may be problematic when converted to deltas._process
after smoothing and jitter fixes etc have been applied. We could consider profiling the smoothed delta instead of the fixed physics tick delta. It would be much more useful to users.