|
|
@@ -808,6 +808,9 @@ struct MeterLabel : ui::Label { |
|
|
|
int frameIndex = 0; |
|
|
|
double frameDurationTotal = 0.0; |
|
|
|
double frameDurationAvg = 0.0; |
|
|
|
double uiLastTime = 0.0; |
|
|
|
double uiLastThreadTime = 0.0; |
|
|
|
double uiFrac = 0.0; |
|
|
|
|
|
|
|
void step() override { |
|
|
|
// Compute frame rate |
|
|
@@ -820,9 +823,19 @@ struct MeterLabel : ui::Label { |
|
|
|
frameIndex = 0; |
|
|
|
} |
|
|
|
|
|
|
|
// Compute UI thread CPU |
|
|
|
double time = system::getTime(); |
|
|
|
double uiDuration = time - uiLastTime; |
|
|
|
if (uiDuration >= 1.0) { |
|
|
|
double threadTime = system::getThreadTime(); |
|
|
|
uiFrac = (threadTime - uiLastThreadTime) / uiDuration; |
|
|
|
uiLastThreadTime = threadTime; |
|
|
|
uiLastTime = time; |
|
|
|
} |
|
|
|
|
|
|
|
double meterAverage = APP->engine->getMeterAverage(); |
|
|
|
double meterMax = APP->engine->getMeterMax(); |
|
|
|
text = string::f("%.1f fps %.1f%% avg %.1f%% max", 1.0 / frameDurationAvg, meterAverage * 100, meterMax * 100); |
|
|
|
text = string::f("%.1f fps %.1f%% avg %.1f%% max %.1f%% UI", 1.0 / frameDurationAvg, meterAverage * 100, meterMax * 100, uiFrac * 100); |
|
|
|
Label::step(); |
|
|
|
} |
|
|
|
}; |
|
|
|