- if (baseGpuTime == 0) {
- baseGpuTime = gpuStart;
- }
-
- if (baseCpuTime == 0) {
- baseCpuTime = cpuStart;
- }
-
- lastFrame.no = no;
- lastFrame.gpuStart = gpuStart;
- lastFrame.cpuStart = cpuStart;
-
- if (gpuTimes) {
- gpuStart = gpuStart - baseGpuTime;
- } else {
- gpuStart = 0;
- }
-
- if (cpuTimes) {
- double cpuTimeScale = 1.0E9 / os::timeFrequency;
- cpuStart = (cpuStart - baseCpuTime) * cpuTimeScale;
- } else {
- cpuStart = 0;
- }
-
- std::cout << "frame_begin"
- << " " << no
- << " " << gpuStart
- << " " << cpuStart
- << std::endl;
-}
-
-void Profiler::addFrameEnd(uint64_t gpuEnd, uint64_t cpuEnd)
-{
- uint64_t gpuDuration, cpuDuration;
-
- if (gpuTimes) {
- gpuDuration = gpuEnd - lastFrame.gpuStart;
- gpuEnd = gpuEnd - baseGpuTime;
- } else {
- gpuEnd = 0;
- gpuDuration = 0;
- }
-
- if (cpuTimes) {
- double cpuTimeScale = 1.0E9 / os::timeFrequency;
- cpuDuration = (cpuEnd - lastFrame.cpuStart) * cpuTimeScale;
- cpuEnd = (cpuEnd - baseCpuTime) * cpuTimeScale;
- } else {
- cpuEnd = 0;
- cpuDuration = 0;
- }
-
- std::cout << "frame_end"
- << " " << lastFrame.no
- << " " << gpuEnd
- << " " << gpuDuration
- << " " << cpuEnd
- << " " << cpuDuration
- << std::endl;