}
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) {
/* 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);
}
void
retrace::waitForInput(void) {
+ glretrace::Context *currentContext = glretrace::getCurrentContext();
+ if (currentContext) {
+ glretrace::flushQueries();
+ glFlush();
+ }
while (glws::processEvents()) {
os::sleep(100*1000);
}