Pulls from component properties named timing1, timing2, timing3
Calculates and smartly displays up to 3 exclusive and "with children" timings
Displays orange warning when > 3ms, red warning when > 8ms
What doesn't / Need feedback on
Ignores stock widgets
It doesn't solve collecting timings for paint calls which... impossible without some hacking, this is the method I'm using
We could show avg/max but I'd like to keep things simple on this iteration, maybe just max + 2 last timings?
I'd like to provide a RAII helper so people could just manually pop in melatonin::populateTiming (this) but haven't done this yet.
For the prototype I'm using a std::deque, storing the last 100 of them and push new timings on the front, but this isn't going to be friendly for others I think. I was interested in creating tooling that would show more of a timeline, but that's going to take more work than stuffing a few things into properties.
Just for clarity is what I currently have in the component I derive everything from.
// derived classes no longer implement this
void paint (juce::Graphics& g) final
{
juce::int64 startTimeTicks = juce::Time::getHighResolutionTicks();
// Call derived class paintContent method
timedPaint (g);
static auto scalar = 1.0 / static_cast<double> (juce::Time::getHighResolutionTicksPerSecond());
paintTimings.push_front (static_cast<double> (juce::Time::getHighResolutionTicks() - startTimeTicks) * scalar);
// limit to 100 entries
if (paintTimings.size() > 3)
paintTimings.pop_back();
setProperty ("timing1", paintTimings[0]);
setProperty ("timing2", paintTimings[1]);
setProperty ("timing3", paintTimings[2]);
}
Opening this for feedback. /cc @dikadk @FigBug
Finally got some paint timings in place.
https://github.com/sudara/melatonin_inspector/assets/472/3d11d4bc-e5db-4849-b3f4-4f3959d17289
What works:
timing1
,timing2
,timing3
What doesn't / Need feedback on
melatonin::populateTiming (this)
but haven't done this yet.For the prototype I'm using a
std::deque
, storing the last 100 of them and push new timings on the front, but this isn't going to be friendly for others I think. I was interested in creating tooling that would show more of a timeline, but that's going to take more work than stuffing a few things into properties.Just for clarity is what I currently have in the component I derive everything from.