+ if (baseGpuTime == 0) {
+ baseGpuTime = gpuStart;
+ }
+
+ if (baseCpuTime == 0) {
+ baseCpuTime = cpuStart;
+ }
+
+ if (gpuTimes) {
+ lastFrame.gpuStart = gpuStart - baseGpuTime;
+ } else {
+ lastFrame.gpuStart = 0;
+ }
+
+ if (cpuTimes) {
+ lastFrame.cpuStart = cpuStart - baseCpuTime;
+ } else {
+ lastFrame.cpuStart = 0;
+ }
+
+ lastFrame.no = no;
+
+ std::cout << "frame_begin"
+ << " " << lastFrame.no
+ << " " << lastFrame.gpuStart
+ << " " << lastFrame.cpuStart
+ << std::endl;
+}
+
+void Profiler::addFrameEnd(uint64_t gpuEnd, uint64_t cpuEnd)
+{
+ uint64_t gpuDuration, cpuDuration;
+
+ if (gpuTimes) {
+ gpuEnd -= baseGpuTime;
+ gpuDuration = gpuEnd - lastFrame.gpuStart;
+ } else {
+ gpuEnd = 0;
+ gpuDuration = 0;
+ }
+
+ if (cpuTimes) {
+ cpuEnd -= baseCpuTime;
+ cpuDuration = cpuEnd - lastFrame.cpuStart;
+ } else {
+ cpuEnd = 0;
+ cpuDuration = 0;
+ }