- assert(profile->frames.size());
- Profile::Call call;
-
- line >> call.no
- >> call.gpuStart
- >> call.gpuDuration
- >> call.cpuStart
- >> call.cpuDuration
- >> call.pixels
- >> call.program
- >> call.name;
-
- profile->frames.back().calls.push_back(call);
- } else if (type.compare("frame_begin") == 0) {
+ Profile::DrawCall draw;
+ unsigned program;
+
+ line >> draw.no
+ >> draw.gpuStart
+ >> draw.gpuDuration
+ >> draw.cpuStart
+ >> draw.cpuDuration
+ >> draw.pixels
+ >> program
+ >> draw.name;
+
+ if (lastGpuTime < draw.gpuStart + draw.gpuDuration) {
+ lastGpuTime = draw.gpuStart + draw.gpuDuration;
+ }
+
+ if (lastCpuTime < draw.cpuStart + draw.cpuDuration) {
+ lastCpuTime = draw.cpuStart + draw.cpuDuration;
+ }
+
+ if (draw.pixels >= 0) {
+ if (profile->programs.size() <= program) {
+ profile->programs.resize(program + 1);
+ }
+
+ profile->programs[program].cpuTotal += draw.cpuDuration;
+ profile->programs[program].gpuTotal += draw.gpuDuration;
+ profile->programs[program].pixelTotal += draw.pixels;
+ profile->programs[program].drawCalls.push_back(draw);
+ }
+
+ Profile::CpuCall call;
+ call.no = draw.no;
+ call.name = draw.name;
+ call.cpuStart = draw.cpuStart;
+ call.cpuDuration = draw.cpuDuration;
+ profile->cpuCalls.push_back(call);
+ } else if (type.compare("frame_end") == 0) {