X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglretrace_main.cpp;h=d215133cbff906ff3c6e912bb574ee834dfc8a7d;hb=342e9725ecc44cf882ee13f87d5099f71f2700af;hp=1591287c22d9d254507dba27a23c5245a5e83d20;hpb=d7c738e13decf8a8a891008c51b437ccbe3434fb;p=apitrace diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp index 1591287..d215133 100755 --- a/retrace/glretrace_main.cpp +++ b/retrace/glretrace_main.cpp @@ -178,7 +178,9 @@ completeCallQuery(CallQuery& query) { } if (retrace::profilingCpuTimes) { - cpuDuration = query.cpuEnd - query.cpuStart; + double cpuTimeScale = 1.0E9 / getTimeFrequency(); + cpuDuration = (query.cpuEnd - query.cpuStart) * cpuTimeScale; + query.cpuStart *= cpuTimeScale; } if (retrace::profilingMemoryUsage) { @@ -318,7 +320,8 @@ initContext() { /* Sync the gpu and cpu start times */ if (retrace::profilingCpuTimes || retrace::profilingGpuTimes) { if (!retrace::profiler.hasBaseTimes()) { - GLint64 currentTime = getCurrentTime(); + double cpuTimeScale = 1.0E9 / getTimeFrequency(); + GLint64 currentTime = getCurrentTime() * cpuTimeScale; retrace::profiler.setBaseCpuTime(currentTime); retrace::profiler.setBaseGpuTime(currentTime); } @@ -476,6 +479,11 @@ retrace::flushRendering(void) { void retrace::waitForInput(void) { + glretrace::Context *currentContext = glretrace::getCurrentContext(); + if (currentContext) { + glretrace::flushQueries(); + glFlush(); + } while (glws::processEvents()) { os::sleep(100*1000); }