Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions MarathonRecomp/gpu/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ struct Profiler
};

static double g_applicationValues[PROFILER_VALUE_COUNT];
static Profiler g_cpuFrameProfiler;
static Profiler g_gpuFrameProfiler;
static Profiler g_presentProfiler;
static Profiler g_frameFenceProfiler;
Expand Down Expand Up @@ -1756,6 +1757,7 @@ static void DrawProfiler()
g_applicationValues[g_profilerValueIndex] = App::s_deltaTime * 1000.0;

const auto applicationAvg = std::accumulate(g_applicationValues, g_applicationValues + PROFILER_VALUE_COUNT, 0.0) / PROFILER_VALUE_COUNT;
const auto cpuFrameAvg = g_cpuFrameProfiler.UpdateAndReturnAverage();
const auto gpuFrameAvg = g_gpuFrameProfiler.UpdateAndReturnAverage();
const auto presentAvg = g_presentProfiler.UpdateAndReturnAverage();
const auto frameFenceAvg = g_frameFenceProfiler.UpdateAndReturnAverage();
Expand All @@ -1769,6 +1771,7 @@ static void DrawProfiler()
ImPlot::SetupAxisLimits(ImAxis_Y1, 0.0, 20.0);
ImPlot::SetupAxis(ImAxis_Y1, "ms", ImPlotAxisFlags_None);
ImPlot::PlotLine<double>("Application", g_applicationValues, PROFILER_VALUE_COUNT, 1.0, 0.0, ImPlotLineFlags_None, g_profilerValueIndex);
ImPlot::PlotLine<double>("CPU Frame", g_cpuFrameProfiler.values, PROFILER_VALUE_COUNT, 1.0, 0.0, ImPlotLineFlags_None, g_profilerValueIndex);
ImPlot::PlotLine<double>("GPU Frame", g_gpuFrameProfiler.values, PROFILER_VALUE_COUNT, 1.0, 0.0, ImPlotLineFlags_None, g_profilerValueIndex);
ImPlot::PlotLine<double>("Present", g_presentProfiler.values, PROFILER_VALUE_COUNT, 1.0, 0.0, ImPlotLineFlags_None, g_profilerValueIndex);
ImPlot::PlotLine<double>("Present Wait", g_presentWaitProfiler.values, PROFILER_VALUE_COUNT, 1.0, 0.0, ImPlotLineFlags_None, g_profilerValueIndex);
Expand Down Expand Up @@ -1809,6 +1812,7 @@ static void DrawProfiler()

// -------- Name ---------------- Current Time --------------------------- Average Time -------- Current FPS ----------------------------- Average FPS ---------- //
drawPerfRow("Application", App::s_deltaTime * 1000.0, applicationAvg, true, 1.0 / App::s_deltaTime, 1000.0 / applicationAvg);
drawPerfRow("CPU Frame", g_cpuFrameProfiler.value.load(), cpuFrameAvg, true, 1000.0 / g_cpuFrameProfiler.value.load(), 1000.0 / cpuFrameAvg );
drawPerfRow("GPU Frame", g_gpuFrameProfiler.value.load(), gpuFrameAvg, true, 1000.0 / g_gpuFrameProfiler.value.load(), 1000.0 / gpuFrameAvg );
drawPerfRow("Present", g_presentProfiler.value.load(), presentAvg, true, 1000.0 / g_presentProfiler.value.load(), 1000.0 / presentAvg );
drawPerfRow("Present Wait", g_presentWaitProfiler.value.load(), presentWaitAvg );
Expand Down Expand Up @@ -2492,6 +2496,8 @@ void Video::Present()
g_executedCommandList.wait(false);
g_executedCommandList = false;

g_cpuFrameProfiler.End();

if (g_swapChainValid)
{
if (g_pendingWaitOnSwapChain)
Expand Down Expand Up @@ -2562,6 +2568,8 @@ void Video::Present()
s_next += 1000000000ns / Config::FPS;
}

g_cpuFrameProfiler.Begin();

g_presentProfiler.Reset();
}

Expand Down
Loading